https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98796

            Bug ID: 98796
           Summary: Incorrect .debug_line emitted for DWARF5
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

GCC emits incorrect DWARF5 on empty translation units.
> empty.c
gcc -S -gdwarf-5 -dA empty.c -o empty.s -gno-as-loc-support
or
gcc -S -gdwarf-5 -dA empty.c -o empty.s -flto -ffat-lto-objects
emits

        .byte   0       # Directory entry format count
        .uleb128 0      # Directories count
        .byte   0       # File name entry format count
        .uleb128 0      # File names count
at the end of .debug_line or .gnu.debuglto_.debug_line sections.
The DWARF5 specification says:
"The first entry is the current directory of the compilation."
and
"The first entry in the sequence is the primary source file whose file name
exactly matches that given in the DW_AT_name attribute in the compilation unit
debugging information entry."
which is not honored when no directory and file name entries are provided.

Reply via email to