Bug 20934 - [4.1 Regression] Segmentation fault in gnat1
Summary: [4.1 Regression] Segmentation fault in gnat1
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords: build, ice-on-valid-code
: 20942 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-04-10 20:47 UTC by John David Anglin
Modified: 2005-07-23 22:49 UTC (History)
4 users (show)

See Also:
Host: hppa-unknown-linux-gnu
Target: hppa-unknown-linux-gnu
Build: hppa-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Hot/Cold patch (271 bytes, patch)
2005-04-11 01:52 UTC, Andrew Pinski
Details | Diff
patch which Caroline sent me to attach (1.74 KB, patch)
2005-04-11 17:24 UTC, Andrew Pinski
Details | Diff
new patch which Caroline sent me to attach (1.74 KB, patch)
2005-04-11 19:05 UTC, Andrew Pinski
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2005-04-10 20:47:41 UTC
stage1/xgcc -Bstage1/ -B/home/dave/opt/gnu/gcc/gcc-4.1.0/hppa-linux/bin/ -c -g -
O2      -gnatpg -gnata -I- -I. -Iada -I../../gcc/gcc/ada ../../gcc/gcc/ada/ada.a
ds -o ada/ada.o
+===========================GNAT BUG DETECTED==============================+
| 4.1.0 20050410 (experimental) (hppa-unknown-linux-gnu) Segmentation fault|
| Error detected at ada.ads:17:1                                           |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact gcc or gnatmake command that you entered.              |
| Also include sources listed below in gnatchop format                     |
| (concatenated together with no headers between files).                   |
+==========================================================================+

This is the backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x008bdd88 in in_unlikely_text_section () at ../../gcc/gcc/varasm.c:309
309           ret_val = ((in_section == in_unlikely_executed_text)
(gdb) bt
#0  0x008bdd88 in in_unlikely_text_section () at ../../gcc/gcc/varasm.c:309
#1  0x008be220 in named_section_real (name=0xaa8900 ".debug_info", flags=1024,
    decl=0x0) at ../../gcc/gcc/varasm.c:444
#2  0x0060a640 in output_comp_unit (die=0x4000b150, output_if_empty=0)
    at ../../gcc/gcc/dwarf2out.c:7108
#3  0x0062229c in dwarf2out_finish (
    filename=0xbff0007c "../../gcc/gcc/ada/ada.ads")
    at ../../gcc/gcc/dwarf2out.c:13916
#4  0x00880d78 in compile_file () at ../../gcc/gcc/toplev.c:1038
#5  0x00883c1c in do_compile () at ../../gcc/gcc/toplev.c:2120
#6  0x00883cc0 in toplev_main (argc=15, argv=0xbff005d4)
    at ../../gcc/gcc/toplev.c:2152
#7  0x003ff3dc in main (argc=15, argv=0xbff005d4) at ../../gcc/gcc/main.c:35

0x008bdd84 <in_unlikely_text_section+160>:      ldw c(,r3),r19
0x008bdd88 <in_unlikely_text_section+164>:      ldw ec(,r19),r19
0x008bdd8c <in_unlikely_text_section+168>:      cmpib,=,n 0,r19,0x8bddbc <
in_unlikely_text_section+216>

(gdb) p/x $r19
$4 = 0x0
(gdb) p cfun
$5 = (struct function *) 0x0
(gdb) p in_section
$6 = in_named

It looks as if we need a check on cfun:

309           ret_val = ((in_section == in_unlikely_executed_text)
310                      || (in_section == in_named
311                          && cfun->unlikely_text_section_name
312                          && strcmp (in_named_name,
313                                     cfun->unlikely_text_section_name) == 0));
Comment 1 Andrew Pinski 2005-04-10 20:51:23 UTC
This might also be the failure which Diego is seeing with libjava building:
http://gcc.gnu.org/ml/gcc-patches/2005-04/msg01050.html
Comment 2 dave 2005-04-10 20:53:30 UTC
Subject: Re:  [4.1 Regression] Segmentation fault in gnat1

> This might also be the failure which Diego is seeing with libjava building:
> http://gcc.gnu.org/ml/gcc-patches/2005-04/msg01050.html

I think this started yesterday.  In any event, a build yesterday evening
failed the same way.

Dave
Comment 3 Andrew Pinski 2005-04-11 01:52:01 UTC
Created attachment 8582 [details]
Hot/Cold patch

Patch by David which was attached to the wrong bug.
Comment 4 Kazu Hirata 2005-04-11 03:52:29 UTC
This patch fixes bootstrap failure on i686-pc-linux-gnu.
Comment 5 Andrew Pinski 2005-04-11 12:44:49 UTC
*** Bug 20942 has been marked as a duplicate of this bug. ***
Comment 6 Andrew Pinski 2005-04-11 17:24:34 UTC
Created attachment 8594 [details]
patch which Caroline sent me to attach

"I mistakenly assumed that if current_function_decl
was defined, then the decl would  always have a function struct attached to it;
also that when
we were writing out debug information, current_function_decl would be defined."
Comment 7 Andrew Pinski 2005-04-11 19:05:40 UTC
Created attachment 8595 [details]
new patch which Caroline sent me to attach

Apparently there were two typo's in the patch I sent to you,
both in dwarf2out.c:

dwarf2out.c line 6816:	'internal_eror' should be 'internal_error'



dwarf2out.c line 7671:	'cfun = = NULL' should be 'cfun = NULL'

Attached is a patch with these two lines corrected.
Comment 8 Andrew Pinski 2005-04-15 15:56:45 UTC
Fixed by reverting the patch which caused this.