www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: kennytm gmail.com



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: -------
Apr 27 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5902


kennytm gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |http://d.puremagic.com/issu
                   |                            |es/show_bug.cgi?id=4504,
                   |                            |http://d.puremagic.com/issu
                   |                            |es/show_bug.cgi?id=5499
            Summary|ICE(toir.c) with -inline    |ICE(toir.c) when there is a
                   |when there is a             |cross-module call to a
                   |cross-module call to a      |closure
                   |closure                     |



Correction: -inline is *not* required.

----------------------------
$ dmd x
Internal error: toir.c 190
----------------------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 27 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5902


SomeDude <lovelydear mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear mailmetrash.com
           Platform|Other                       |All
         OS/Version|Mac OS X                    |All



PDT ---
Fails also on Win32 2.059

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