public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/102373] New: Segmentation fault in dwarf2out.c, line 32744
@ 2021-09-16 17:32 danglin at gcc dot gnu.org
  2021-09-16 17:38 ` [Bug debug/102373] " jakub at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: danglin at gcc dot gnu.org @ 2021-09-16 17:32 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debug/102373] Segmentation fault in dwarf2out.c, line 32744
  2021-09-16 17:32 [Bug debug/102373] New: Segmentation fault in dwarf2out.c, line 32744 danglin at gcc dot gnu.org
@ 2021-09-16 17:38 ` jakub at gcc dot gnu.org
  2021-09-16 18:02 ` dave.anglin at bell dot net
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-09-16 17:38 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Comment on attachment 51471
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51471
Fix NULL pointer dereference

This looks wrong, comp_unit_die () should have DW_AT_producer at this point.
gen_compile_unit_die should have added it...

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debug/102373] Segmentation fault in dwarf2out.c, line 32744
  2021-09-16 17:32 [Bug debug/102373] New: Segmentation fault in dwarf2out.c, line 32744 danglin at gcc dot gnu.org
  2021-09-16 17:38 ` [Bug debug/102373] " jakub at gcc dot gnu.org
@ 2021-09-16 18:02 ` dave.anglin at bell dot net
  2021-09-17  6:40 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dave.anglin at bell dot net @ 2021-09-16 18:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from dave.anglin at bell dot net ---
On 2021-09-16 1:38 p.m., jakub at gcc dot gnu.org wrote:
> This looks wrong, comp_unit_die () should have DW_AT_producer at this point.
> gen_compile_unit_die should have added it...
I did change dwarf_version to 4.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debug/102373] Segmentation fault in dwarf2out.c, line 32744
  2021-09-16 17:32 [Bug debug/102373] New: Segmentation fault in dwarf2out.c, line 32744 danglin at gcc dot gnu.org
  2021-09-16 17:38 ` [Bug debug/102373] " jakub at gcc dot gnu.org
  2021-09-16 18:02 ` dave.anglin at bell dot net
@ 2021-09-17  6:40 ` rguenth at gcc dot gnu.org
  2021-09-17  6:46 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-09-17  6:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to dave.anglin from comment #2)
> On 2021-09-16 1:38 p.m., jakub at gcc dot gnu.org wrote:
> > This looks wrong, comp_unit_die () should have DW_AT_producer at this point.
> > gen_compile_unit_die should have added it...
> I did change dwarf_version to 4.

That shouldn't change anything - look at comp_unit_die () and how it
eventually calls gen_compile_unit_die which adds DW_AT_producer.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debug/102373] Segmentation fault in dwarf2out.c, line 32744
  2021-09-16 17:32 [Bug debug/102373] New: Segmentation fault in dwarf2out.c, line 32744 danglin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-09-17  6:40 ` rguenth at gcc dot gnu.org
@ 2021-09-17  6:46 ` rguenth at gcc dot gnu.org
  2021-09-17 12:46 ` dave.anglin at bell dot net
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-09-17  6:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Btw, it works with a cross from x86_64 to hppa64-hp-hpux11, but maybe I'm doing
it wrong?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debug/102373] Segmentation fault in dwarf2out.c, line 32744
  2021-09-16 17:32 [Bug debug/102373] New: Segmentation fault in dwarf2out.c, line 32744 danglin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-09-17  6:46 ` rguenth at gcc dot gnu.org
@ 2021-09-17 12:46 ` dave.anglin at bell dot net
  2021-10-01 17:34 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dave.anglin at bell dot net @ 2021-09-17 12:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from dave.anglin at bell dot net ---
On 2021-09-17 2:46 a.m., rguenth at gcc dot gnu.org wrote:
> Btw, it works with a cross from x86_64 to hppa64-hp-hpux11, but maybe I'm doing
> it wrong?
It's probably caused by a bug in the TImode support that I'm working on.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debug/102373] Segmentation fault in dwarf2out.c, line 32744
  2021-09-16 17:32 [Bug debug/102373] New: Segmentation fault in dwarf2out.c, line 32744 danglin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-09-17 12:46 ` dave.anglin at bell dot net
@ 2021-10-01 17:34 ` cvs-commit at gcc dot gnu.org
  2021-10-01 17:36 ` cvs-commit at gcc dot gnu.org
  2021-10-01 17:43 ` danglin at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-01 17:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by John David Anglin <danglin@gcc.gnu.org>:

https://gcc.gnu.org/g:f1710910087fb1f4a7706e9ce838163ffcbc50b4

commit r12-4058-gf1710910087fb1f4a7706e9ce838163ffcbc50b4
Author: John David Anglin <danglin@gcc.gnu.org>
Date:   Fri Oct 1 17:34:09 2021 +0000

    Default to dwarf version 4 on hppa64-hpux

    2021-10-01  John David Anglin  <danglin@gcc.gnu.org>

    gcc/ChangeLog:

            PR debug/102373
            * config/pa/pa.c (pa_option_override): Default to dwarf version 4
            on hppa64-hpux.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debug/102373] Segmentation fault in dwarf2out.c, line 32744
  2021-09-16 17:32 [Bug debug/102373] New: Segmentation fault in dwarf2out.c, line 32744 danglin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-10-01 17:34 ` cvs-commit at gcc dot gnu.org
@ 2021-10-01 17:36 ` cvs-commit at gcc dot gnu.org
  2021-10-01 17:43 ` danglin at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-01 17:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by John David Anglin
<danglin@gcc.gnu.org>:

https://gcc.gnu.org/g:aac3b6a7e3a7b810005343e62e6822338fcb85d4

commit r11-9052-gaac3b6a7e3a7b810005343e62e6822338fcb85d4
Author: John David Anglin <danglin@gcc.gnu.org>
Date:   Fri Oct 1 17:35:45 2021 +0000

    Default to dwarf version 4 on hppa64-hpux

    2021-10-01  John David Anglin  <danglin@gcc.gnu.org>

    gcc/ChangeLog:

            PR debug/102373
            * config/pa/pa.c (pa_option_override): Default to dwarf version 4
            on hppa64-hpux.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debug/102373] Segmentation fault in dwarf2out.c, line 32744
  2021-09-16 17:32 [Bug debug/102373] New: Segmentation fault in dwarf2out.c, line 32744 danglin at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-10-01 17:36 ` cvs-commit at gcc dot gnu.org
@ 2021-10-01 17:43 ` danglin at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: danglin at gcc dot gnu.org @ 2021-10-01 17:43 UTC (permalink / raw)
  To: gcc-bugs

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

John David Anglin <danglin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from John David Anglin <danglin at gcc dot gnu.org> ---
Fixed.  Problem was I didn't set dwarf_strict to 1 in change to limit dwarf
version.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-10-01 17:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 17:32 [Bug debug/102373] New: Segmentation fault in dwarf2out.c, line 32744 danglin at gcc dot gnu.org
2021-09-16 17:38 ` [Bug debug/102373] " jakub at gcc dot gnu.org
2021-09-16 18:02 ` dave.anglin at bell dot net
2021-09-17  6:40 ` rguenth at gcc dot gnu.org
2021-09-17  6:46 ` rguenth at gcc dot gnu.org
2021-09-17 12:46 ` dave.anglin at bell dot net
2021-10-01 17:34 ` cvs-commit at gcc dot gnu.org
2021-10-01 17:36 ` cvs-commit at gcc dot gnu.org
2021-10-01 17:43 ` danglin at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).