6001 – CTFE: ICE(interpret.c) mutating array passed by ref

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6001 - CTFE: ICE(interpret.c) mutating array passed by ref
Summary: CTFE: ICE(interpret.c) mutating array passed by ref
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: ice-on-valid-code
: 6134 (view as issue list)
Depends on:
Blocks:
Reported: 2011年05月14日 09:45 UTC by Stephan Dilly
Modified: 2015年06月09日 05:11 UTC (History)
3 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Stephan Dilly 2011年05月14日 09:45:03 UTC
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 kennytm 2011年05月14日 10:44:04 UTC
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 3 Don 2011年06月11日 22:32:57 UTC
*** Issue 6134 has been marked as a duplicate of this issue. ***


AltStyle によって変換されたページ (->オリジナル) /