https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102373
Bug ID: 102373 Summary: Segmentation fault in dwarf2out.c, line 32744 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: danglin at gcc dot gnu.org Target Milestone: --- Host: hppa64-hp-hpux* Target: hppa64-hp-hpux* Build: hppa64-hp-hpux* Created attachment 51471 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51471&action=edit Fix NULL pointer dereference The fault occurs on trunk with the following: int main (void) { return 0; } /home/dave/gnu/gcc/objdir64/./gcc/cc1 -fpreprocessed xxx.i -quiet -dumpbase xxx .c -dumpbase-ext .c -g -O2 -version -fno-checking -o xxx.s GNU C17 (GCC) version 12.0.0 20210907 (experimental) (hppa64-hp-hpux11.11) compiled by GNU C version 12.0.0 20210907 (experimental), GMP version 6. 1.1, MPFR version 3.1.5, MPC version 1.0.3, isl version isl-0.22.1-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C17 (GCC) version 12.0.0 20210907 (experimental) (hppa64-hp-hpux11.11) compiled by GNU C version 12.0.0 20210907 (experimental), GMP version 6. 1.1, MPFR version 3.1.5, MPC version 1.0.3, isl version isl-0.22.1-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 64b9df7c6b0f1e93f698a828b6c17964 xxx.c:5:1: internal compiler error: Segmentation fault 5 | } | ^ (gdb) r Starting program: /home/dave/gnu/gcc/objdir64/gcc/cc1 -fpreprocessed xxx.i -quiet -dumpbase xxx.c -dumpbase-ext .c -g -O2 -version -fno-checking -o xxx.s GNU C17 (GCC) version 12.0.0 20210907 (experimental) (hppa64-hp-hpux11.11) compiled by GNU C version 12.0.0 20210907 (experimental), GMP version 6.1.1, MPFR version 3.1.5, MPC version 1.0.3, isl version isl-0.22.1-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C17 (GCC) version 12.0.0 20210907 (experimental) (hppa64-hp-hpux11.11) compiled by GNU C version 12.0.0 20210907 (experimental), GMP version 6.1.1, MPFR version 3.1.5, MPC version 1.0.3, isl version isl-0.22.1-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 64b9df7c6b0f1e93f698a828b6c17964 Program received signal SIGSEGV, Segmentation fault. 0x40000000006939b4 in dwarf2out_early_finish ( filename=0x8000000100313eb0 "xxx.c") at ../../gcc/gcc/dwarf2out.c:32744 32744 producer_string = gen_producer_string (lang_hooks.name, (gdb) disass Dump of assembler code for function dwarf2out_early_finish(char const*): 0x40000000006938c8 <+0>: std rp,-10(sp) 0x40000000006938cc <+4>: addil L%-16800,dp,r1 0x40000000006938d0 <+8>: ldo 180(sp),sp 0x40000000006938d4 <+12>: std r13,-c8(sp) 0x40000000006938d8 <+16>: ldd 2b0(r1),r13 0x40000000006938dc <+20>: addil L%-16000,dp,r1 0x40000000006938e0 <+24>: std r7,-98(sp) 0x40000000006938e4 <+28>: ldd 230(r1),r7 0x40000000006938e8 <+32>: std r6,-90(sp) 0x40000000006938ec <+36>: std r18,-f0(sp) 0x40000000006938f0 <+40>: std r17,-e8(sp) 0x40000000006938f4 <+44>: std r16,-e0(sp) 0x40000000006938f8 <+48>: std r15,-d8(sp) 0x40000000006938fc <+52>: std r14,-d0(sp) 0x4000000000693900 <+56>: std r12,-c0(sp) 0x4000000000693904 <+60>: std r11,-b8(sp) 0x4000000000693908 <+64>: std r10,-b0(sp) 0x400000000069390c <+68>: std r9,-a8(sp) 0x4000000000693910 <+72>: std r8,-a0(sp) 0x4000000000693914 <+76>: std r5,-88(sp) 0x4000000000693918 <+80>: std r4,-80(sp) 0x400000000069391c <+84>: std r3,-78(sp) ---Type <return> to continue, or q <return> to quit--- 0x4000000000693920 <+88>: ldb 0(r13),r19 0x4000000000693924 <+92>: std r19,-108(sp) 0x4000000000693928 <+96>: ldb 0(r7),ret0 0x400000000069392c <+100>: cmpib,<> 0,ret0,0x4000000000695434 <dwarf2out_early_finish(char const*)+7020> 0x4000000000693930 <+104>: copy r26,r6 0x4000000000693934 <+108>: ldi 1,ret0 0x4000000000693938 <+112>: stb ret0,0(r13) 0x400000000069393c <+116>: addil L%-16000,dp,r1 0x4000000000693940 <+120>: ldd 238(r1),r11 0x4000000000693944 <+124>: ldd 0(r11),r26 0x4000000000693948 <+128>: cmpb,*= r0,r26,0x4000000000694c60 <dwarf2out_early_finish(char const*)+5016> 0x400000000069394c <+132>: ldo -30(sp),ret1 0x4000000000693950 <+136>: copy dp,r4 0x4000000000693954 <+140>: ldo -30(sp),ret1 0x4000000000693958 <+144>: b,l 0x4000000000640ec0 <get_AT(die_struct*, dwarf_attribute)>,rp 0x400000000069395c <+148>: ldi 25,r25 0x4000000000693960 <+152>: copy r4,dp 0x4000000000693964 <+156>: addil L%-27800,dp,r1 0x4000000000693968 <+160>: ldd 440(r1),r31 0x400000000069396c <+164>: addil L%-27800,dp,r1 ---Type <return> to continue, or q <return> to quit--- 0x4000000000693970 <+168>: copy ret0,r3 0x4000000000693974 <+172>: ldd 4b8(r1),r9 0x4000000000693978 <+176>: ldw 13ec(r9),ret0 0x400000000069397c <+180>: cmpib,= 0,ret0,0x4000000000693a90 <dwarf2out_early_finish(char const*)+456> 0x4000000000693980 <+184>: ldd 0(r31),r26 0x4000000000693984 <+188>: addil L%-15000,dp,r1 0x4000000000693988 <+192>: copy r1,ret0 0x400000000069398c <+196>: ldd 40(ret0),r31 0x4000000000693990 <+200>: ldw 0(r31),r24 0x4000000000693994 <+204>: addil L%-15000,dp,r1 0x4000000000693998 <+208>: ldd 48(r1),ret0 0x400000000069399c <+212>: copy dp,r4 0x40000000006939a0 <+216>: ldo -30(sp),ret1 0x40000000006939a4 <+220>: b,l 0x4000000000699178 <.stub+256>,rp 0x40000000006939a8 <+224>: ldd 0(ret0),r25 0x40000000006939ac <+228>: copy r4,dp 0x40000000006939b0 <+232>: copy ret0,r26 => 0x40000000006939b4 <+236>: ldd 18(r3),r31 Problem is call to get_AT has returned NULL.