Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 90c140f

Browse files
authored
Merge pull request #2220 from schveiguy/fix18996
Fix issue 18996 - ProtoGC should support removing roots and ranges that were not originally added
2 parents 42e555a + 1b0af1e commit 90c140f

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

src/gc/impl/proto/gc.d

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ class ProtoGC : GC
177177
return;
178178
}
179179
}
180-
assert(false);
181180
}
182181

183182
@property RootIterator rootIter() return @nogc
@@ -211,7 +210,6 @@ class ProtoGC : GC
211210
return;
212211
}
213212
}
214-
assert(false);
215213
}
216214

217215
@property RangeIterator rangeIter() return @nogc

test/init_fini/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
include ../common.mak
22

3-
TESTS:=thread_join runtime_args
3+
TESTS:=thread_join runtime_args test18996
44

55
.PHONY: all clean
66
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))

test/init_fini/src/test18996.d

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Issue https://issues.dlang.org/show_bug.cgi?id=18996
2+
// Array!string calls removeRange without first adding the range, but never
3+
// initializes the GC. The behavior of the default GC is to ignore removing
4+
// ranges when the range wasn't added. The ProtoGC originally would crash when
5+
// this happened.
6+
7+
import core.memory;
8+
9+
void main()
10+
{
11+
GC.removeRange(null);
12+
GC.removeRoot(null);
13+
}

0 commit comments

Comments
 (0)