You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DMD ICE: Can't link simple program with -profile=gc #21033
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
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
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
-----
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.
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.
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)
/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
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
Activity
jmdavis commentedon Mar 19, 2025
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=gcin the title. It does happen when I add that.[-]DMD ICE: Can't link simple program with -profile=gc[/-][+]DMD ICE: Can't link simple program with `-profile=gc`[/+]0xEAB commentedon Mar 21, 2025
thewilsonator commentedon Jul 5, 2025
cc @teodutu this looks like something you might know about.
teodutu commentedon Jul 5, 2025
Yup, in #15299 I converted
_d_newarrayUto a template, but I only created a trageCG wrapper for_d_newarrayTbecause I only saw that being used in the tests. I can create_d_newarrayUTraceand fix this issue next week. I'll also look into_d_newarraymTX#15819 and make sure it doesn't suffer from this as well.thewilsonator commentedon Jul 5, 2025
thanks
Fix dlang#21033: Add template `_d_newarrayUTrace`
fix dlang#21033: Add template `_d_newarrayUTrace`
fix dlang#21033 - DMD ICE: Can't link simple program with -profile=gc
fix dlang#21033 - DMD ICE: Can't link simple program with -profile=gc
`std.array.d`: Use template `_d_newarrayU{,Trace}
teodutu commentedon Jul 12, 2025
To fix this issue, dlang/phobos#10819 must be merged after #21525. It changes the calls from
std.array.dfrom the non-template_d_newarrayU{,Trace}to their template counterparts.fix #21033 - DMD ICE: Can't link simple program with -profile=gc (#21525
`std.array.d`: Use template `_d_newarrayU{,Trace}
`std.array.d`: Use template `_d_newarrayU{,Trace}`
`std.array.d`: Use template `_d_newarrayU{,Trace}` (#10819)
0xEAB commentedon Jul 24, 2025
All aforementioned PRs have been merge AFAICT; can this issue be closed?
teodutu commentedon Jul 24, 2025
I'd say so.
0xEAB commentedon Jul 24, 2025
(It’s not like we couldn’t reopen it if needed.)
jersni commentedon Sep 13, 2025
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)
0xEAB commentedon Feb 1, 2026
./dev/dmd/generated/linux/release/64/dmd -profile=gc test.dgit -C dev/dmd statusgit -C dev/phobos statusMrcSnm commentedon Apr 2, 2026
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
0xEAB commentedon Apr 4, 2026
Let’s split off a duplicate so that it one won’t be closed by time 4fc3fac is merged somewhere.
→ dlang/phobos#10989