[Issue 5902] New: ICE(toir.c) with -inline when there is a cross-module call to a closure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 27 12:37:01 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5902

           Summary: ICE(toir.c) with -inline when there is a cross-module
                    call to a closure
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: ice-on-invalid-code, ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: kennytm at gmail.com


--- Comment #0 from kennytm at gmail.com 2011-04-27 12:33:17 PDT ---
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 :) )

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list