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
Comment #3 by clugdbug — 2011-06-11T22:32:57Z
*** Issue 6134 has been marked as a duplicate of this issue. ***