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

            Bug ID: 89362
           Summary: [8/9 regression] zlib support breaks libbacktrace on
                    strict-alignment platforms
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: libbacktrace
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ebotcazou at gcc dot gnu.org
                CC: ian at gcc dot gnu.org
  Target Milestone: ---

The new zlib support (PR other/67165) has broken the library on
strict-alignment platforms, for example SPARC64/Linux.  Here's a typical ICE
report:

ebotcazou@gcc202:~/build$ gcc/cc1 -quiet pr35318.c -m32 -mcpu=ultrasparc       
pr35318.c: In function 'foo':
pr35318.c:9:1: error: unrecognizable insn:
    9 | }
      | ^
(insn 14 28 29 2 (parallel [
            (set (reg:DF 10 %o2 [orig:113 x ] [113])
                (asm_operands/v:DF ("") ("=r,r") 0 [
                        (reg:SI 11 %o3 [orig:113 x+4 ] [113])
                        (mem/c:DF (plus:SI (reg/f:SI 30 %fp)
                                (const_int -24 [0xffffffffffffffe8])) [3
%sfp+-24 S8 A64])
                    ]
                     [
                        (asm_input:DF ("%0,0") pr35318.c:8)
                        (asm_input:SI ("m,r") pr35318.c:8)
                    ]
                     [] pr35318.c:8))
            (set (reg:DF 2 %g2 [orig:114 y ] [114])
                (asm_operands/v:DF ("") ("=r,r") 1 [
                        (reg:SI 11 %o3 [orig:113 x+4 ] [113])
                        (mem/c:DF (plus:SI (reg/f:SI 30 %fp)
                                (const_int -24 [0xffffffffffffffe8])) [3
%sfp+-24 S8 A64])
                    ]
                     [
                        (asm_input:DF ("%0,0") pr35318.c:8)
                        (asm_input:SI ("m,r") pr35318.c:8)
                    ]
                     [] pr35318.c:8))
        ]) "pr35318.c":8:3 -1
     (nil))
during RTL pass: reload

during RTL pass: reload
pr35318.c:9:1: internal compiler error: in extract_constrain_insn, at
recog.c:2211

pr35318.c:9:1: internal compiler error: Bus error
Bus error

Program received signal SIGBUS, Bus error.
0x0000010000138ab4 in elf_uncompress_chdr (state=0xfff8000100044000, 
    compressed=0xfff8000104ca48af "", compressed_size=4074875, 
    zdebug_table=0xfff800010353e000, error_callback=
    0x1000011dfc4 <__sanitizer::(anonymous namespace)::ErrorCallback(void*,
char const*, int)>, data=0x7feffffd5b8, uncompressed=0x7feffffc670, 
    uncompressed_size=0x7feffffc668)
    at
/home/ebotcazou/src/libsanitizer/libbacktrace/../../libbacktrace/elf.c:2580
2580      if (chdr->ch_type != ELFCOMPRESS_ZLIB)

The problem is that most debug sections have alignment 1 so you cannot do:

 chdr = (const b_elf_chdr *) compressed;

and expect to have a valid b_elf_chdr on strict-alignment platforms.

This also breaks the sanitizer on these platforms.

Reply via email to