Bug 5902 – ICE(toir.c) when there is a cross-module call to a closure

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-04-27T12:33:00Z
Last change time
2014-04-11T12:18:35Z
Keywords
ice
Assigned to
nobody
Creator
kennytm
See also
http://d.puremagic.com/issues/show_bug.cgi?id=4504, http://d.puremagic.com/issues/show_bug.cgi?id=5499

Comments

Comment #0 by kennytm — 2011-04-27T12:33:17Z
Test case: -------------------- // x.d: import y; struct A(alias f) { void front() { f(); } } void main() { int sectid; void g(){ cast(void) sectid; } // access a local variable (make a closure) s!(A!g); } -------------------- // y.d: void s(ROR)() { void r() { ROR().front(); } } -------------------- $ dmd -inline x Internal error: toir.c 190 -------------------- * If '-inline' is removed, the bug is gone. * If I suppress output by providing the '-o-' flag, the bug is gone. * If the function 's()' is moved into 'x.d', the bug is gone. * If the 'ROR().front()' call is not placed inside the function 'r', the ICE is gone, and the error becomes ----------------------- y.d(3): Error: function D main is a nested function and cannot be accessed from s x.d(11): Error: function D main is a nested function and cannot be accessed from s ----------------------- Maybe the same as issue 4504 or issue 5499, which also relates to function delegates. (I don't know if it is valid code or not, so I put both ice-on keywords :) )
Comment #1 by kennytm — 2011-04-27T12:35:48Z
Correction: -inline is *not* required. ---------------------------- $ dmd x Internal error: toir.c 190 ----------------------------
Comment #2 by lovelydear — 2012-04-20T10:27:18Z
Fails also on Win32 2.059
Comment #3 by k.hara.pg — 2014-04-11T12:18:35Z
(In reply to kennytm from comment #0) > Test case: > > -------------------- > // x.d: > import y; > struct A(alias f) { > void front() { > f(); > } > } > void main() { > int sectid; > void g(){ cast(void) sectid; } // access a local variable (make a > closure) > s!(A!g); > } > -------------------- > // y.d: > void s(ROR)() { > void r() { > ROR().front(); > } > } By fixing issue 8704, ROR() in y.d will produce "cannot access frame pointer of x.main" error from front-end layer. Then the glue-layer error will be fixed. *** This issue has been marked as a duplicate of issue 8704 ***