Bug 22374 – [REG 2.093] 'import std;' with -checkaction=context causes link error

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-10-10T03:21:03Z
Last change time
2024-12-13T19:18:43Z
Assigned to
No Owner
Creator
Paul Backus
See also
https://issues.dlang.org/show_bug.cgi?id=22902
Moved to GitHub: dmd#19992 →

Comments

Comment #0 by snarwin+bugzilla — 2021-10-10T03:21:03Z
As of DMD 2.097.2, compiling the following program with the flag `-checkaction=context` results in a linker error. --- import std; void main() { assert(0); } --- The error is: --- /usr/bin/ld: bug.o: in function `_Dmain': bug.d:(.text._Dmain[_Dmain]+0x33): undefined reference to `_D4core8internal7dassert__T14_d_assert_failTiZQtFNaNbNiNfMxAyaxiZAya' collect2: error: ld returned 1 exit status Error: linker exited with status 1 --- Demangled: --- /usr/bin/ld: bug.o: in function `_Dmain': bug.d:(.text._Dmain[_Dmain]+0x33): undefined reference to `pure nothrow @nogc @safe immutable(char)[] core.internal.dassert._d_assert_fail!(int)._d_assert_fail(scope const(immutable(char)[]), const(int))' collect2: error: ld returned 1 exit status Error: linker exited with status 1 --- Removing the line `import std;`, or changing it to import a different module such as `std.range`, causes the program to compile and link successfully. According to run.dlang.io, this is a regression introduced in DMD 2.093.
Comment #1 by andrej.mitrovich — 2022-09-08T15:18:48Z
Just ran into this one. So sad it's been broken for a year. I don't recall what was the reason this option is enabled via the -checkaction=context switch? Is it to avoid additional memory allocations?
Comment #2 by elpenguino+D — 2022-12-19T23:03:13Z
I've just encountered this as well. Still fails on DMD 2.101.1 with the same missing symbol, but when combined with -allinst, it fails in a subtly different way: ``` /dlang/dmd/linux/bin64/../../src/phobos/std/variant.d:941: error: undefined reference to '_D4core8internal7dassert__T14_d_assert_failTbZQtFNaNbNiNfMxAyaxbZAya' ``` This one is a `pure nothrow @nogc @safe immutable(char)[] core.internal.dassert._d_assert_fail!(bool)._d_assert_fail(scope const(immutable(char)[]), const(bool))`
Comment #3 by kdevel — 2024-09-30T10:41:44Z
(In reply to Paul Backus from comment #0) > As of DMD 2.097.2, compiling the following program with the flag > `-checkaction=context` results in a linker error. > > --- > import std; > > void main() > { > assert(0); > } > --- > WORKSFORME $ dmd --version DMD64 D Compiler v2.109.1 Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved written by Walter Bright $ cat asszer.d import std; void main() { assert(0); } $ dmd asszer.d $ ./asszer [email protected](5): Assertion failure ---------------- ??:? _d_assertp [0x4bbf14] ??:? _Dmain [0x4b30e0]
Comment #4 by kdevel — 2024-09-30T10:45:07Z
Correction: WORKSFORME $ dmd -checkaction=context asszer.d $ ./asszer [email protected](5): Assertion failure ---------------- ??:? _d_assertp [0x4bbf14] ??:? _Dmain [0x4b30e0]
Comment #5 by robert.schadek — 2024-12-13T19:18:43Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19992 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB