www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Illegal instruction (code dumped) for any uncaught exception

reply zhade <notexisting email.com> writes:
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?

```d
void main()
{
     assert(false);
}
```

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

Same for any other exception:
```d
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):
```

core.internal.backtrace.dwarf.readEntryFormat(ref const(ubyte)[], 
ref core.internal.container.array.Array!(ulong).Array) ()
    from /usr/lib64/libdruntime-ldc-shared.so.96

core.internal.backtrace.dwarf.readLineNumberProgram(ref 
const(ubyte)[]) () from /usr/lib64/libdruntime-ldc-shared.so.96

core.internal.backtrace.dwarf.resolveAddresses(const(ubyte)[], 
core.internal.backtrace.dwarf.Location[], ulong) ()
    from /usr/lib64/libdruntime-ldc-shared.so.96

core.internal.backtrace.dwarf.processCallstack(core.internal.backtra
e.dwarf.Location[], const(ubyte)[], ulong, scope int(ref ulong, ref
const(char[])) delegate) () from /usr/lib64/libdruntime-ldc-shared.so.96

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

core.internal.backtrace.elf.Image.processDebugLineSectionData!(int).processDebugL
neSectionData(scope int(const(ubyte)[]) delegate)
     () from /usr/lib64/libdruntime-ldc-shared.so.96

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

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

_DThn16_4core7runtime16DefaultTraceInfo7opApplyMxFMDFKxAaZiZi () 
from /usr/lib64/libdruntime-ldc-shared.so.96

char[]) delegate) const () from 
/usr/lib64/libdruntime-ldc-shared.so.96

rt.dmain2.formatThrowable(object.Throwable, scope void(scope 
const(char[])) nothrow delegate).__foreachbody3(object.Throwable) 
()
    from /usr/lib64/libdruntime-ldc-shared.so.96

int(object.Throwable) delegate) () from 
/usr/lib64/libdruntime-ldc-shared.so.96

extern(C) int(char[][]) function).runAll() () from 
/usr/lib64/libdruntime-ldc-shared.so.96

    from /usr/lib64/libdruntime-ldc-shared.so.96

    from /usr/lib64/libdruntime-ldc-shared.so.96

     at /usr/include/d/core/internal/entrypoint.d:42

<main>, argc=1,
     argv=0x7fffffffded8, init=<optimized out>, fini=<optimized 
out>,
     rtld_fini=<optimized out>, stack_end=0x7fffffffdec8)
     at ../csu/libc-start.c:332

../sysdeps/x86_64/start.S:120
```

Any help would be much appreciated!
Jun 11
parent reply kinke <noone nowhere.com> writes:
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
Jun 11
parent zhade <notexistant email.com> writes:
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.
Jun 12