Thread overview
Illegal instruction (code dumped) for any uncaught exception
Jun 11, 2021
zhade
Jun 11, 2021
kinke
Jun 12, 2021
zhade
June 11, 2021

After a distro update (openSuse) every uncaught exception causes an illegal instruction error. After some searching I couldn't find anyone else having this problem. So I assume this is only happening on my machine. But I have no idea what could be the cause? Faulty packages in my distribution?

void main()
{
    assert(false);
}

Results in:

ore.exception.AssertError@source/app.d(4): Assertion failure
----------------Illegal instruction (core dumped)

Same for any other exception:

void main()
{
    throw new Exception("Error");
}

I am not using any flags. Just running dub build. Compiling with dmd -debug source/app.d results in the same error.

My distro updated ldc2 Version 1.24.0 to 1.26.0.
Which also updated druntime and phobos from 2.094.1 to 2.096.1.
The same error occurs when using dmd version 2.096.1.

GDB backtrace (same for dmd):

#0  0x00007ffff7a97379 in core.internal.backtrace.dwarf.readEntryFormat(ref const(ubyte)[], ref core.internal.container.array.Array!(ulong).Array) ()
   from /usr/lib64/libdruntime-ldc-shared.so.96
#1  0x00007ffff7a962fd in core.internal.backtrace.dwarf.readLineNumberProgram(ref const(ubyte)[]) () from /usr/lib64/libdruntime-ldc-shared.so.96
#2  0x00007ffff7a95fbb in core.internal.backtrace.dwarf.resolveAddresses(const(ubyte)[], core.internal.backtrace.dwarf.Location[], ulong) ()
   from /usr/lib64/libdruntime-ldc-shared.so.96
#3  0x00007ffff7a95d1a in core.internal.backtrace.dwarf.processCallstack(core.internal.backtrace.dwarf.Location[], const(ubyte)[], ulong, scope int(ref ulong, ref const(char[])) delegate) () from /usr/lib64/libdruntime-ldc-shared.so.96
#4  0x00007ffff7a95e68 in core.internal.backtrace.dwarf.traceHandlerOpApplyImpl(ulong, scope const(void)*(ulong) delegate, scope const(char)[](ulong) delegate, scope int(ref ulong, ref const(char[])) delegate).__lambda13!(const(ubyte)[]).__lambda13(const(ubyte)[]) () from /usr/lib64/libdruntime-ldc-shared.so.96
#5  0x00007ffff7a98340 in core.internal.backtrace.elf.Image.processDebugLineSectionData!(int).processDebugLineSectionData(scope int(const(ubyte)[]) delegate)
    () from /usr/lib64/libdruntime-ldc-shared.so.96
#6  0x00007ffff7a95b75 in core.internal.backtrace.dwarf.traceHandlerOpApplyImpl(ulong, scope const(void)*(ulong) delegate, scope const(char)[](ulong) delegate, scope int(ref ulong, ref const(char[])) delegate) ()
   from /usr/lib64/libdruntime-ldc-shared.so.96
#7  0x00007ffff7ab4d91 in core.runtime.DefaultTraceInfo.opApply(scope int(ref ul--Type <RET> for more, q to quit, c to continue without paging--
ong, ref const(char[])) delegate) const ()
   from /usr/lib64/libdruntime-ldc-shared.so.96
#8  0x00007ffff7ab4fd5 in _DThn16_4core7runtime16DefaultTraceInfo7opApplyMxFMDFKxAaZiZi () from /usr/lib64/libdruntime-ldc-shared.so.96
#9  0x00007ffff7ac285c in object.Throwable.toString(scope void(in char[]) delegate) const () from /usr/lib64/libdruntime-ldc-shared.so.96
#10 0x00007ffff7aca26b in rt.dmain2.formatThrowable(object.Throwable, scope void(scope const(char[])) nothrow delegate).__foreachbody3(object.Throwable) ()
   from /usr/lib64/libdruntime-ldc-shared.so.96
#11 0x00007ffff7ac2699 in object.Throwable.opApply(scope int(object.Throwable) delegate) () from /usr/lib64/libdruntime-ldc-shared.so.96
#12 0x00007ffff7aca204 in rt.dmain2._d_run_main2(char[][], ulong, extern(C) int(char[][]) function).runAll() () from /usr/lib64/libdruntime-ldc-shared.so.96
#13 0x00007ffff7ac9eef in _d_run_main2 ()
   from /usr/lib64/libdruntime-ldc-shared.so.96
#14 0x00007ffff7ac9d4e in _d_run_main ()
   from /usr/lib64/libdruntime-ldc-shared.so.96
#15 0x00000000004007a5 in main (argc=1, argv=0x7fffffffded8)
    at /usr/include/d/core/internal/entrypoint.d:42
#16 0x00007ffff76beb35 in __libc_start_main (main=0x400780 <main>, argc=1,
    argv=0x7fffffffded8, init=<optimized out>, fini=<optimized out>,
    rtld_fini=<optimized out>, stack_end=0x7fffffffdec8)
    at ../csu/libc-start.c:332
#17 0x000000000040067e in _start () at ../sysdeps/x86_64/start.S:120

Any help would be much appreciated!

June 11, 2021

On Friday, 11 June 2021 at 18:16:02 UTC, zhade wrote:

>

[...]

I've heard of trouble with exactly the same (gdb) backtrace from people using latest Arch Linux. Druntime v2.095 got support for DWARF v5, introducing this readEntryFormat() function with a couple of assert(0), almost certainly causing the illegal instruction. The initial suspicion was that the switch to gcc 11 (with DWARF emission changes) might be causing this; possibly in the few C files compiled into druntime and Phobos.

The druntime PR adding these assert(0) was: https://github.com/dlang/druntime/pull/3189

June 12, 2021

On Friday, 11 June 2021 at 21:14:40 UTC, kinke wrote:

>

I've heard of trouble with exactly the same (gdb) backtrace from people using latest Arch Linux. Druntime v2.095 got support for DWARF v5, introducing this readEntryFormat() function with a couple of assert(0), almost certainly causing the illegal instruction. The initial suspicion was that the switch to gcc 11 (with DWARF emission changes) might be causing this; possibly in the few C files compiled into druntime and Phobos.

The druntime PR adding these assert(0) was: https://github.com/dlang/druntime/pull/3189

Thank you, now I know that it isn't just my machine. So I guess I'll have to wait for the new dwarf format to be fully supported, rollback my packages or manually compile druntime with an earlier gcc. I'll see if I can find time to try it out.