www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17936] New: [ICE] compiling some Objective-C code with -lib

https://issues.dlang.org/show_bug.cgi?id=17936

          Issue ID: 17936
           Summary: [ICE] compiling some Objective-C code with -lib flag
                    fails
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: doob me.com

Compiling the following code:

void alloc()
{
    AppDelegate a;
    a.alloc();
}

void shared_()
{
    NSApplication a;
    a.shared_();
}

extern (Objective-C):

interface NSApplication
{
    NSApplication shared_()  selector("sharedApplication");
}

interface AppDelegate
{
    AppDelegate alloc()  selector("alloc");
}


With the "-lib" flag (dmd -lib main.d) results in the following error:

Internal error: ddmd/backend/machobj.c 244

The failing line is [1]. It occurs with both DMD 2.071.0 and 2.077.0-beta.2 so
it's probably been like that from the beginning. The Objective-C methods need
to be called and they need to be at least two for the error to occur.

[1]
https://github.com/dlang/dmd/blob/51bc2fb427a5e0b3701b11ab2b6a5f356d8eca5d/src/ddmd/backend/machobj.c#L2440

--
Oct 25