www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17740] New: ghost "internal" symbols show up sometimes

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

          Issue ID: 17740
           Summary: ghost "internal" symbols show up sometimes
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: schveiguy yahoo.com

In unknown circumstances, CTFE initializations can cause a symbol "internal" to
be emitted to the object file. I'm pretty sure this isn't supposed to happen.

When it does happen, you get linker errors that "internal" isn't defined.

A current example where it is blocking a PR:
https://github.com/dlang/phobos/pull/5683

Note the error from the builds:
generated/freebsd/release/32/libphobos2.a(file_5f5_798.o)(.text._D3std4file28__T17statTimeToStdTimeVai97Z17statTimeToStdTimeFNaNbNfKS4core3sys5posix3sys4stat6stat_tZS3std8datetime7systime7SysTime+0x61):
In function
`_D3std4file28__T17statTimeToStdTimeVai97Z17statTimeToStdTimeFNaNbNfKS4core3sys5posix3sys4stat6stat_tZS3std8datetime7systime7SysTime':
: undefined reference to `internal'
generated/freebsd/release/32/libphobos2.a(file_5f6_7a4.o)(.text._D3std4file29__T17statTimeToStdTimeVai109Z17statTimeToStdTimeFNaNbNfKS4core3sys5posix3sys4stat6stat_tZS3std8datetime7systime7SysTime+0x61):
In function
`_D3std4file29__T17statTimeToStdTimeVai109Z17statTimeToStdTimeFNaNbNfKS4core3sys5posix3sys4stat6stat_tZS3std8datetime7systime7SysTime':
: undefined reference to `internal'
generated/freebsd/release/32/libphobos2.a(systime_31a9_2ce.o)(.data+0x0):
undefined reference to `internal'
generated/freebsd/release/32/libphobos2.a(systime_31a9_2ce.o)(.rodata+0x8):
undefined reference to `internal'
generated/freebsd/release/32/libphobos2.a(systime_31a9_2ce.o)(.text._D3std8datetime7systime7SysTime11toLocalTimeMxFNaNbNfZS3std8datetime7systime7SysTime+0x18):
In function
`_D3std8datetime7systime7SysTime11toLocalTimeMxFNaNbNfZS3std8datetime7systime7SysTime':
: undefined reference to `internal'
generated/freebsd/release/32/libphobos2.a(systime_31a9_2ce.o)(.text._D3std8datetime7systime7SysTime5toUTCMxFNaNbNfZS3std8datetime7systime7SysTime+0x18):
more undefined references to `internal' follow

Another example:
https://github.com/dlang/dmd/blob/master/src/ddmd/tocsym.d#L681

I found in the compiler these lines:
https://github.com/dlang/dmd/blob/master/src/ddmd/tocsym.d#L662
https://github.com/dlang/dmd/blob/master/src/ddmd/tocsym.d#L681

Which explain how the symbol name is generated. Those are in a section titled
"CTFE stuff".

Just recording this bug here so it's not forgotten. I have no idea how to
reduce it.

--
Aug 10 2017