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

Commit

Permalink
Merge pull request #2220 from schveiguy/fix18996
Browse files Browse the repository at this point in the history
Fix issue 18996 - ProtoGC should support removing roots and ranges that were not originally added
  • Loading branch information
wilzbach committed Jun 18, 2018
2 parents 42e555a + 1b0af1e commit 90c140f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/gc/impl/proto/gc.d
Expand Up @@ -177,7 +177,6 @@ class ProtoGC : GC
return;
}
}
assert(false);
}

@property RootIterator rootIter() return @nogc
Expand Down Expand Up @@ -211,7 +210,6 @@ class ProtoGC : GC
return;
}
}
assert(false);
}

@property RangeIterator rangeIter() return @nogc
Expand Down
2 changes: 1 addition & 1 deletion test/init_fini/Makefile
@@ -1,6 +1,6 @@
include ../common.mak

TESTS:=thread_join runtime_args
TESTS:=thread_join runtime_args test18996

.PHONY: all clean
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
Expand Down
13 changes: 13 additions & 0 deletions test/init_fini/src/test18996.d
@@ -0,0 +1,13 @@
// Issue https://issues.dlang.org/show_bug.cgi?id=18996
// Array!string calls removeRange without first adding the range, but never
// initializes the GC. The behavior of the default GC is to ignore removing
// ranges when the range wasn't added. The ProtoGC originally would crash when
// this happened.

import core.memory;

void main()
{
GC.removeRange(null);
GC.removeRoot(null);
}

0 comments on commit 90c140f

Please sign in to comment.