[Issue 24590] Illegal instruction with module constructors cycle and shared libphobos2 in _d_criticalenter2

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 9 03:35:42 UTC 2024


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

--- Comment #1 from Andrei Horodniceanu <a.horodniceanu at proton.me> ---
> The code above fails with both dmd and ldc2 but not with gdc.

My bad, I forgot to pass `-shared-libphobos` when building with gdc. With the
flag disabled I get:
----
object.Error@/var/tmp/portage/sys-devel/gcc-14.1.1_p20240518/work/gcc-14-20240518/libphobos/libdruntime/rt/minfo.d(372):
Cyclic dependency between module constructors/destructors of b and a
b* ->
a* ->
b*

----
And when passing the flag I get:
----
object.Error@/var/tmp/portage/sys-devel/gcc-14.1.1_p20240518/work/gcc-14-20240518/libphobos/libdruntime/rt/minfo.d(372):
Cyclic dependency between module constructors/destructors of b and a
b* ->
a* ->
b*

----------------
??:? _d_createTrace [0x7fafb9cfe3fb]
??:? _d_throw [0x7fafb9cf23b4]
??:? ???[0x7fafb9d02c08]
??:? ???[0x7fafb9d02b7d]
??:? ???[0x7fafb9d02d87]
??:? nothrow void rt.minfo.ModuleGroup.sortCtors(immutable(char)[])
[0x7fafb9d04317]
??:? ???[0x7fafb9d04427]
??:? int gcc.sections.elf.DSO.opApply(scope int delegate(ref
gcc.sections.elf.DSO)) [0x7fafb9cf321a]
??:? rt_init [0x7fafb9cfe84a]
??:? ???[0x7fafb9cfe9ef]
??:? _d_run_main2 [0x7fafb9cfed1b]
??:? _d_run_main [0x7fafb9cfeefc]
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/d/core/internal/entrypoint.d:29
main [0x560cd1844306]
??:? ???[0x7fafb96592df]
??:? __libc_start_main [0x7fafb9659398]
??:? _start [0x560cd1844094]
??:? ???[0xffffffffffffffff]
----

Which is an improvement since it's not a crash.

--


More information about the Digitalmars-d-bugs mailing list