Skip to content

DMD ICE: Can't link simple program with -profile=gc #21033

Closed

Description

@MrcSnm
import std.path;
void main()
{
	buildPath("tester", " a");
}

Tested with run.dlang.io with All Compilers. Looks like that program never was able to build.

That was causing ICE on my program which has multiple cases of that.

I also get that at the reduced example:

/dlang/dmd/linux/bin64/../../src/phobos/std/array.d:1112: error: undefined reference to '_d_newarrayUTrace'
collect2: error: ld returned 1 exit status
Error: undefined reference to `_d_newarrayUTrace`
       perhaps a library needs to be added with the `-L` flag or `pragma(lib, ...)`
Error: linker exited with status 1

Activity

  1. jmdavis commented on Mar 19, 2025

    @jmdavis
    Member

    Are you sure that you copied the code correctly? I just tried it both locally and on run.dlang.io with All Compilers, and it worked just fine.

    EDIT: Nevermind. I missed the -profile=gc in the title. It does happen when I add that.

  2. added theissue type on Mar 20, 2025
  3. changed the title [-]DMD ICE: Can't link simple program with -profile=gc[/-] [+]DMD ICE: Can't link simple program with `-profile=gc`[/+] on Mar 21, 2025
  4. added
    Severity:Regression
    on Mar 21, 2025
  5. 0xEAB commented on Mar 21, 2025

    @0xEAB
    Member
    Up to      2.102.2: Success and no output
               2.103.1: Segfault and no output
    2.104.2 to 2.105.3: Success and no output
    Since      2.106.1: Failure with output:
    -----
    onlineapp.o: In function `_D3std5array__T14arrayAllocImplVbi0TAmTmZQBaFNaNbmZQp':
    /path/to/dmd.linux/dmd2/linux/bin64/../../src/phobos/std/array.d:1112: undefined reference to `_d_newarrayUTrace'
    collect2: error: ld returned 1 exit status
    Error: linker exited with status 1
    -----
    
  6. thewilsonator commented on Jul 5, 2025

    @thewilsonator
    Contributor

    cc @teodutu this looks like something you might know about.

  7. teodutu commented on Jul 5, 2025

    @teodutu
    Member

    Yup, in #15299 I converted _d_newarrayU to a template, but I only created a trageCG wrapper for _d_newarrayT because I only saw that being used in the tests. I can create _d_newarrayUTrace and fix this issue next week. I'll also look into _d_newarraymTX #15819 and make sure it doesn't suffer from this as well.

  8. thewilsonator commented on Jul 5, 2025

    @thewilsonator
    Contributor

    thanks

  9. added 5 commits that reference this issue on Jul 11, 2025
    49d3931
    b1f74e7
    364a3e9
    4dc4316
    9872d18
  10. teodutu commented on Jul 12, 2025

    @teodutu
    Member

    To fix this issue, dlang/phobos#10819 must be merged after #21525. It changes the calls from std.array.d from the non-template _d_newarrayU{,Trace} to their template counterparts.

  11. added a commit that references this issue on Jul 12, 2025
    a18f759
  12. added 2 commits that reference this issue on Jul 12, 2025
    054b784
    e33d9b4
  13. added a commit that references this issue on Jul 21, 2025
    4fc3fac
  14. 0xEAB commented on Jul 24, 2025

    @0xEAB
    Member

    All aforementioned PRs have been merge AFAICT; can this issue be closed?

  15. teodutu commented on Jul 24, 2025

    @teodutu
    Member

    I'd say so.

  16. 0xEAB commented on Jul 24, 2025

    @0xEAB
    Member

    (It’s not like we couldn’t reopen it if needed.)

  17. jersni commented on Sep 13, 2025

    @jersni

    This is happening for me in a project I'm working on, and just confirmed it happens in the small program in the original report by MrcSnm. I'm using DMD64 D Compiler v2.111.0 on Fedora Linux 42.

    Also tried the nightly and have the same issue (DMD64 D Compiler v2.112.0-beta.1)

  18. 0xEAB commented on Feb 1, 2026

    @0xEAB
    Member
    ./dev/dmd/generated/linux/release/64/dmd -profile=gc test.d
    /usr/bin/ld: test.o: in function `std.array.arrayAllocImpl!(false, ulong[], ulong).arrayAllocImpl(ulong)':
    test.d:(.text._D3std5array__T14arrayAllocImplVbi0TAmTmZQBaFNaNbmZQp[_D3std5array__T14arrayAllocImplVbi0TAmTmZQBaFNaNbmZQp]+0x53): undefined reference to `_d_newarrayUTrace'
    collect2: error: ld returned 1 exit status
    Error: undefined reference to `_d_newarrayUTrace`
           referenced from `pure nothrow ulong[] std.array.arrayAllocImpl!(false, ulong[], ulong).arrayAllocImpl(ulong)`
           perhaps a library needs to be added with the `-L` flag or `pragma(lib, ...)`
    Error: linker exited with status 1
           cc test.o -o test -m64 -Xlinker --export-dynamic -L./dev/dmd/generated/linux/release/64/../../../../../phobos/generated/linux/release/64 -Xlinker -Bstatic -lphobos2 -Xlinker -Bdynamic -lpthread -lm -lrt -ldl 
    
    git -C dev/dmd status
    On branch master
    Your branch is up to date with 'origin/master'.
    
    nothing to commit, working tree clean
    
    git -C dev/phobos status
    On branch master
    Your branch is up to date with 'origin/master'.
    
    nothing to commit, working tree clean
    
  19. reopened this on Feb 1, 2026
  20. reopened this on Mar 29, 2026
  21. MrcSnm commented on Apr 2, 2026

    @MrcSnm
    ContributorAuthor

    Can someone please add a test with profile-gc? People is closing without even having tests in DMD. That other issue is related to template hooks #22842

  22. 0xEAB commented on Apr 4, 2026

    @0xEAB
    Member

    Let’s split off a duplicate so that it one won’t be closed by time 4fc3fac is merged somewhere.

    → dlang/phobos#10989

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Severity:Regression

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions