← Back to index
|
Original Bugzilla link
Bug 6001 – CTFE: ICE(interpret.c) mutating array passed by ref
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-05-14T09:45:00Z
Last change time
2015-06-09T05:11:48Z
Keywords
ice-on-valid-code
Assigned to
nobody
Creator
spam
Comments
Comment #0
by spam — 2011-05-14T09:45:03Z
import std.conv; enum s = to!string(cast(dchar)0); dmd aborts with: Assertion failure: '(newval->op == TOKarrayliteral || newval->op == TOKassocarrayliteral || newval->op == TOKstring || newval->op == TOKslice || newval->op == TOKnull)' on line 2680 in file 'interpret.c'
Comment #1
by kennytm — 2011-05-14T10:44:04Z
Reduced test case: ----------------------- void e(ref int[] s) { // must pass by ref or out int[] r = s; // must alias that parameter s ~= 0; // must mutate 's' or 'r' } bool f() { int[] s; e(s); return false; } enum g = f(); ----------------------- Assertion failed: ((newval->op == TOKarrayliteral || newval->op == TOKassocarrayliteral || newval->op == TOKstring || newval->op == TOKslice || newval->op == TOKnull)), function interpretAssignCommon, file interpret.c, line 2680. Abort trap -----------------------
Comment #2
by clugdbug — 2011-05-18T21:23:48Z
D2:
https://github.com/D-Programming-Language/dmd/commit/3bcaf85ed7aa480da34fba5a1fe0d00bc8f7abf5
D1:
https://github.com/D-Programming-Language/dmd/commit/669cafeb9fecc98d5f4689f379f638a9661f0b35
Comment #3
by clugdbug — 2011-06-11T22:32:57Z
*** Issue 6134 has been marked as a duplicate of this issue. ***