www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22081] New: DWARF v5 support is utterly broken - 'illegal

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

          Issue ID: 22081
           Summary: DWARF v5 support is utterly broken - 'illegal
                    instruction' when throwing exceptions
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: kinke gmx.net

GCC 11 defaults to emitting DWARF v5 (at least with reasonably recent binutils
apparently). If a D executable contains any DWARF 5 line-number programs (e.g.,
from linked-in C(++) object files), the utterly broken druntime code
(introduced by https://github.com/dlang/druntime/pull/3189) hits an assert(0)
when trying to resolve file/line infos for the exception backtrace. So EH is
totally broken.

See https://forum.dlang.org/post/pwhqtnkmghitflnwbfij forum.dlang.org for an
exemplary gdb backtrace.

I've looked at the DWARF 5 spec, and the druntime code is absolutely wrong in
many aspects. It surely hasn't been tested even *once*.

Can be reproduced with LDC and `ldc2 -g -dwarf-version=5 foo.d && ./foo`, for a
foo.d throwing an exception.

--
Jun 23