[Bug debug/98716] [11 Regression] sanitizer regressions by r11-6755

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 18 13:18:32 GMT 2021


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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, seems when asan alloca_big_alignment test is built with -gdwarf-4 -flto, we
have:
  Offset:                      0x57
  Length:                      214
  DWARF Version:               4
  Prologue Length:             105
  Minimum Instruction Length:  1
  Maximum Ops per Instruction: 1
  Initial value of 'is_stmt':  1
  Line Base:                   -5
  Line Range:                  14
  Opcode Base:                 13

 Opcodes:
  Opcode 1 has 0 args
  Opcode 2 has 1 arg
  Opcode 3 has 1 arg
  Opcode 4 has 1 arg
  Opcode 5 has 1 arg
  Opcode 6 has 0 args
  Opcode 7 has 0 args
  Opcode 8 has 0 args
  Opcode 9 has 1 arg
  Opcode 10 has 0 args
  Opcode 11 has 0 args
  Opcode 12 has 1 arg

 The Directory Table (offset 0x73):
  1     /usr/src/gcc/gcc/testsuite/c-c++-common/asan

 The File Name Table (offset 0xa1):
  Entry Dir     Time    Size    Name
  1     1       0       0       alloca_big_alignment.c
  2     0       0       0       <built-in>

 Line Number Statements:
  [0x000000ca]  Set column to 56
  [0x000000cc]  Extended opcode 2: set Address to 0x4011f0
  [0x000000d7]  Special opcode 12: advance Address by 0 to 0x4011f0 and Line by
7 to 8
  [0x000000d8]  Set is_stmt to 0
  [0x000000d9]  Copy (view 1)
  [0x000000da]  Set column to 17
  [0x000000dc]  Special opcode 20: advance Address by 1 to 0x4011f1 and Line by
1 to 9
  [0x000000dd]  Special opcode 89: advance Address by 6 to 0x4011f7 and Line by
0 to 9
  [0x000000de]  Set column to 56
  [0x000000e0]  Special opcode 130: advance Address by 9 to 0x401200 and Line
by -1 to 8
  [0x000000e1]  Advance PC by constant 17 to 0x401211
  [0x000000e2]  Special opcode 47: advance Address by 3 to 0x401214 and Line by
0 to 8
  [0x000000e3]  Set column to 3
  [0x000000e5]  Set is_stmt to 1
  [0x000000e6]  Special opcode 90: advance Address by 6 to 0x40121a and Line by
1 to 9
  [0x000000e7]  Set is_stmt to 0

This is for a TU created by LTO, which in .debug_info has:
    <565>   DW_AT_name        : (indirect string, offset: 0x676): <artificial>
    <569>   DW_AT_comp_dir    : (indirect string, offset: 0x652):
/usr/src/gcc/obj2/gcc/testsuite/gcc
Now, with -gdwarf-5 -flto, is still has:
    <566>   DW_AT_name        : (indirect line string, offset: 0x11d):
<artificial>
    <56a>   DW_AT_comp_dir    : (indirect line string, offset: 0x12a):
/usr/src/gcc/obj2/gcc/testsuite/gcc
but the .debug_lines part starts with:
  Offset:                      0x57
  Length:                      162
  DWARF Version:               5
  Address size (bytes):        8
  Segment selector (bytes):    0
  Prologue Length:             51
  Minimum Instruction Length:  1
  Maximum Ops per Instruction: 1
  Initial value of 'is_stmt':  1
  Line Base:                   -5
  Line Range:                  14
  Opcode Base:                 13

 Opcodes:
  Opcode 1 has 0 args
  Opcode 2 has 1 arg
  Opcode 3 has 1 arg
  Opcode 4 has 1 arg
  Opcode 5 has 1 arg
  Opcode 6 has 0 args
  Opcode 7 has 0 args
  Opcode 8 has 0 args
  Opcode 9 has 1 arg
  Opcode 10 has 0 args
  Opcode 11 has 0 args
  Opcode 12 has 1 arg

 The Directory Table (offset 0x79, lines 2, columns 1):
  Entry Name
  0     (indirect line string, offset: 0x12a):
/usr/src/gcc/obj2/gcc/testsuite/gcc
  1     (indirect line string, offset: 0x14e):
/usr/src/gcc/gcc/testsuite/c-c++-common/asan

 The File Name Table (offset 0x87, lines 3, columns 2):
  Entry Dir     Name
  0     0       (indirect line string, offset: 0x11d): <artificial>
  1     1       (indirect line string, offset: 0x1b3): alloca_big_alignment.c
  2     0       (indirect line string, offset: 0x17b): <built-in>

 Line Number Statements:
  [0x00000096]  Set column to 56
  [0x00000098]  Extended opcode 2: set Address to 0x4011f0
  [0x000000a3]  Special opcode 12: advance Address by 0 to 0x4011f0 and Line by
7 to 8
  [0x000000a4]  Set is_stmt to 0
  [0x000000a5]  Copy (view 1)
  [0x000000a6]  Set column to 17
  [0x000000a8]  Special opcode 20: advance Address by 1 to 0x4011f1 and Line by
1 to 9
  [0x000000a9]  Special opcode 89: advance Address by 6 to 0x4011f7 and Line by
0 to 9
  [0x000000aa]  Set column to 56
  [0x000000ac]  Special opcode 130: advance Address by 9 to 0x401200 and Line
by -1 to 8
  [0x000000ad]  Advance PC by constant 17 to 0x401211
  [0x000000ae]  Special opcode 47: advance Address by 3 to 0x401214 and Line by
0 to 8
  [0x000000af]  Set column to 3
  [0x000000b1]  Set is_stmt to 1
  [0x000000b2]  Special opcode 90: advance Address by 6 to 0x40121a and Line by
1 to 9
  [0x000000b3]  Set is_stmt to 0

So the important difference is in that DWARF5 has the 0 entry in the filename
table while DWARF4 does not.

DWARF5 Table 6.4: Line number program initial state says that the
initial file is 1, which means I think read_line_program in libbacktrace is
incorrect for DWARF5.


More information about the Gcc-bugs mailing list