← Back to index
|
Original Bugzilla link
Bug 8539 – (D1 only) -inline failure involving CTFE, nested functions, a ref parameter
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2012-08-11T12:48:00Z
Last change time
2012-11-08T09:27:21Z
Keywords
CTFE, ice, pull
Assigned to
nobody
Creator
nilsbossung
Comments
Comment #0
by nilsbossung — 2012-08-11T12:48:35Z
test.d: --- int f() { static void one(ref int x) { x = 1; } static void go() { int y; one(y); assert(y == 1); // fails with -inline } go(); return 0; } enum e = f(); --- $ dmd -c -o- test.d $ dmd -c -o- -inline test.d test.d(8): Error: assert(y == 1) failed test.d(10): called from here: go() test.d(13): called from here: f()
Comment #1
by yebblies — 2012-11-02T00:00:34Z
Commit pushed to master at
https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/b52dca5a53def60352dbcbf4f398c10abb2cb6b1
Fix issue 8498 modifying foreach range iterator fails in CTFE This was caused by ignoring assignment to ref variables. (These guys can only be created by the inliner, or by lowering, such as happens in foreach). Also fixes bug 7658: assignment to ref in foreach. Also fixes bug 8539: nested functions, ref parameter, -inline.
Comment #2
by yebblies — 2012-11-02T00:01:26Z
Fixed D2, causes an ICE with D1: src\testx.d(6): Error: CTFE internal error: illegal reference value 0 Assertion failure: 'IsRefValueValid(newval)' on line 6243 in file 'interpret.c' abnormal program termination
Comment #3
by k.hara.pg — 2012-11-08T09:27:09Z
Fixed D1:
https://github.com/D-Programming-Language/dmd/commit/c3f296ab16cb7209f2b2344013d979e85705a681