Bug 50006 - [4.7 Regression] ICE in in connect_traces, at dwarf2cfi.c:2677
Summary: [4.7 Regression] ICE in in connect_traces, at dwarf2cfi.c:2677
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.7.0
Assignee: Richard Henderson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-06 15:18 UTC by John David Anglin
Modified: 2011-10-06 22:35 UTC (History)
1 user (show)

See Also:
Host: hppa2.0w-hp-hpux11.11
Target: hppa2.0w-hp-hpux11.11
Build: hppa2.0w-hp-hpux11.11
Known to work:
Known to fail:
Last reconfirmed: 2011-08-08 21:53:04


Attachments
pr5006.tar.gz (582 bytes, application/x-gzip)
2011-08-08 22:13 UTC, dave.anglin
Details
pr50006.tar.gz (49.79 KB, application/x-gzip)
2011-08-08 23:06 UTC, dave.anglin
Details
proposed patch (446 bytes, patch)
2011-08-12 21:49 UTC, Richard Henderson
Details | Diff
Source files (210.47 KB, application/x-gzip)
2011-08-13 21:33 UTC, John David Anglin
Details
second patch (671 bytes, patch)
2011-08-15 17:39 UTC, Richard Henderson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2011-08-06 15:18:43 UTC
/test/gnu/gcc/objdir/./gcc/xgcc -B/test/gnu/gcc/objdir/./gcc/ -B/opt/gnu/gcc/gcc
-4.7/hppa2.0w-hp-hpux11.11/bin/ -B/opt/gnu/gcc/gcc-4.7/hppa2.0w-hp-hpux11.11/lib
/ -isystem /opt/gnu/gcc/gcc-4.7/hppa2.0w-hp-hpux11.11/include -isystem /opt/gnu/
gcc/gcc-4.7/hppa2.0w-hp-hpux11.11/sys-include    -c -g -O2  -fPIC -frandom-seed=
fixed-seed  -W -Wall -gnatpg   s-os_lib.adb -o s-os_lib.o
+===========================GNAT BUG DETECTED==============================+
| 4.7.0 20110805 (experimental) [trunk revision 177484] (hppa2.0w-hp-hpux11.11) 
GCC error:|
| in connect_traces, at dwarf2cfi.c:2677                                   |
| Error detected around s-os_lib.adb:897:8                                 |
| 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).                   |
+==========================================================================+
Comment 1 John David Anglin 2011-08-08 13:01:14 UTC
(gdb) ignor 1 79
Will ignore next 79 crossings of breakpoint 1.
(gdb) r
Starting program: /home/gnu/gcc/objdir/gcc/gnat1 -gnatwa -quiet -dumpbase s-os_lib.adb -auxbase-strip s-os_lib.o -O2 -Wextra -Wall -fPIC -frandom-seed=fixed-seed -g -gnatpg -gnatO s-os_lib.o s-os_lib.adb -o s-os_lib.s
warning: The shared libraries were not privately mapped; setting a
breakpoint in a shared library will not work until you rerun the program.


Breakpoint 1, execute_dwarf2_frame () at ../../gcc/gcc/dwarf2cfi.c:2677
2677		  gcc_assert (!ti->args_size_undefined);
(gdb) bt
#0  execute_dwarf2_frame () at ../../gcc/gcc/dwarf2cfi.c:2677
#1  0x004e62bc in execute_one_pass (pass=0x400092e8)
    at ../../gcc/gcc/passes.c:2063
#2  0x004e6600 in execute_pass_list (pass=0x400092e8)
    at ../../gcc/gcc/passes.c:2118
#3  0x004e6614 in execute_pass_list (pass=0x4000b200)
    at ../../gcc/gcc/passes.c:2119
#4  0x004e6614 in execute_pass_list (pass=0x4000b234)
    at ../../gcc/gcc/passes.c:2119
#5  0x007374f8 in tree_rest_of_compilation (fndecl=0x7a543700)
    at ../../gcc/gcc/tree-optimize.c:420
#6  0x003e58c8 in cgraph_expand_function (node=0x7ab853c0)
    at ../../gcc/gcc/cgraphunit.c:1803
#7  0x003e7264 in cgraph_optimize () at ../../gcc/gcc/cgraphunit.c:1862
#8  0x003e7754 in cgraph_finalize_compilation_unit ()
    at ../../gcc/gcc/cgraphunit.c:1310
#9  0x0005cf38 in gnat_write_global_declarations ()
    at ../../gcc/gcc/ada/gcc-interface/utils.c:4733
#10 0x005017f0 in toplev_main (argc=0, argv=0x0) at ../../gcc/gcc/toplev.c:564
#11 0x003b1214 in main (argc=0, argv=0x79f59ed0) at ../../gcc/gcc/main.c:36
(gdb) p ti
$1 = (dw_trace_info *) 0x4086a144
(gdb) p *ti
$2 = {head = 0x79f6ad98, beg_row = 0x79f59f30, end_row = 0x79f59f48, 
  beg_true_args_size = 0, end_true_args_size = 0, beg_delay_args_size = 0, 
  end_delay_args_size = 0, eh_head = 0x79f673e8, cfa_store = {offset = -576, 
    base_offset = 0, reg = 30, indirect = 0, in_use = 0}, cfa_temp = {
    offset = 0, base_offset = 0, reg = 3, indirect = 0, in_use = 0}, 
  regs_saved_in_regs = 0x0, id = 3, switch_sections = 0 '\0', 
  args_size_undefined = 1 '\001'}
Comment 2 John David Anglin 2011-08-08 13:25:41 UTC
(gdb) p debug_tree (fndecl)
 <function_decl 7a543700 system__os_lib__create_temp_file_internal.isra.0
    type <function_type 7a33a9c0
        type <record_type 7aea64e0 RETURN sizes-gimplified BLK
            size <integer_cst 7ade08a0 constant 128>
            unit size <integer_cst 7ade08b8 constant 16>
            align 64 symtab 98 alias set 53 canonical type 7aea64e0 fields <field_decl 7aea6540 fd> Ada size <integer_cst 7ade08a0 128>
            pointer_to_this <pointer_type 7a301d20> chain <type_decl 7aea5310 RETURN>>
        SI
        size <integer_cst 7ade0480 constant 32>
        unit size <integer_cst 7ade0498 constant 4>
        align 32 symtab 0 alias set -1 canonical type 7a33a9c0
        arg-types <tree_list 7a33b8b8 value <boolean_type 7ae7a840 boolean>
            chain <tree_list 7ae09c18 value <void_type 7ade9720 void>>>
        ci/co list <tree_list 7aea34f8 purpose <field_decl 7aea6540 fd> value <var_decl 7ac700c0 fd>
            chain <tree_list 7aea3510 purpose <field_decl 7aea65a0 name> value <parm_decl 7aea1688 name>>>
        pointer_to_this <pointer_type 7a33aa20>>
    addressable asm_written static SI file s-os_lib.adb line 775 col 4 align 32 initial <block 7a657120> abstract_origin <function_decl 7ae9ac00 system__os_lib__create_temp_file_internal>
    arguments <parm_decl 7a4758f0 stdout
        type <boolean_type 7ae7a840 boolean readonly sizes-gimplified public unsigned QI
            size <integer_cst 7ade05e8 constant 8>
            unit size <integer_cst 7ade0600 constant 1>
            align 8 symtab 0 alias set -1 canonical type 7ae7a840 precision 8 min <integer_cst 7ade0a38 0> max <integer_cst 7ade0a50 255> RM size <integer_cst 7ade0960 1> RM max <integer_cst 7ade0a68 1>
            pointer_to_this <pointer_type 7a4c8540>>
        readonly used unsigned QI file s-os_lib.adb line 84 col 7 size <integer_cst 7ade05e8 8> unit size <integer_cst 7ade0600 1>
        align 8 context <function_decl 7a543700 system__os_lib__create_temp_file_internal.isra.0> abstract_origin <parm_decl 7aea16e0 stdout>
        (reg/v:SI 11 %r11 [orig:128 stdout+-3 ] [128])
        arg-type <integer_type 7ade93c0 integer sizes-gimplified public visited SI size <integer_cst 7ade0480 32> unit size <integer_cst 7ade0498 4>
            align 32 symtab 1 alias set 2 canonical type 7ade93c0 precision 32 min <integer_cst 7ade06f0 -2147483648> max <integer_cst 7ade0708 2147483647>
            pointer_to_this <pointer_type 7ade9ae0>>
        incoming-rtl (reg:SI 26 %r26 [ stdout+-3 ])>
    result <result_decl 7a5c45a0 D.16576 type <record_type 7aea64e0 RETURN>
        used ignored BLK file s-os_lib.adb line 81 col 14 size <integer_cst 7ade08a0 128> unit size <integer_cst 7ade08b8 16>
        align 64 context <function_decl 7a543700 system__os_lib__create_temp_file_internal.isra.0> abstract_origin <result_decl 7ae95aa0 D.2017>
        (mem/s/c:BLK (reg/f:SI 5 %r5 [127]) [53 <retval>+0 S16 A64])>
    struct-function 7a301ea0>
$3 = void
Comment 3 Richard Henderson 2011-08-08 21:53:04 UTC
Created attachment 24952 [details]
pr5006.tar.gz

Please do as the bug box says wrt sources.  I don't know how to
cross-debug this sort of Ada thing otherwise.

The ICE appears to be detecting incorrect optimization earlier,
judging by the gdb session in #C1.
Comment 4 dave.anglin 2011-08-08 22:13:29 UTC
Created attachment 24953 [details]
pr50006.tar.gz

Attached bug box sources.  These are from hppa2.0w-hp-hpux11.00.

Dave
--
John David Anglin	dave.anglin@bell.net
Comment 5 dave.anglin 2011-08-08 23:06:08 UTC
On 8-Aug-11, at 6:37 PM, danglin at gcc dot gnu.org wrote:

Let's try this again.

--
John David Anglin	dave.anglin@bell.net
Comment 6 Richard Henderson 2011-08-12 21:21:54 UTC
Reproduced via cross-compiler...
Comment 7 Richard Henderson 2011-08-12 21:49:19 UTC
Created attachment 24993 [details]
proposed patch

This seems to fix the bug.  Doing an Ada sanity check on x86_64...
Comment 8 dave.anglin 2011-08-13 01:19:35 UTC
On 12-Aug-11, at 5:49 PM, rth at gcc dot gnu.org wrote:
>  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24993
> proposed patch


Testing on hppa2.0w-hp-hpux11.00.  Will test on hppa2.0w-hp-hpux11.11  
tomorrow
after current build completes.

Thanks,
Dave
--
John David Anglin	dave.anglin@bell.net
Comment 9 John David Anglin 2011-08-13 21:33:41 UTC
Created attachment 25007 [details]
Source files
Comment 10 John David Anglin 2011-08-13 21:35:34 UTC
Unfortunately, the proposed patch isn't sufficient.  We hit another
similar ICE a little later in the build:

../../xgcc -B../../ -c -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmis
sing-prototypes -mdisable-indexing -gnatpg -gnata -I- -I../rts -I. -I/test/gnu/g
cc/gcc/gcc/ada /test/gnu/gcc/gcc/gcc/ada/prj-proc.adb -o prj-proc.o
+===========================GNAT BUG DETECTED==============================+
| 4.7.0 20110813 (experimental) [trunk revision 177733] (hppa2.0w-hp-hpux11.11) 
GCC error:|
| in connect_traces, at dwarf2cfi.c:2677                                   |
| Error detected around /test/gnu/gcc/gcc/gcc/ada/prj-proc.adb:1252:8      |
| 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).                   |
+==========================================================================+

Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.
Consider also -gnatd.n switch (see debug.adb).

../rts/system.ads
/test/gnu/gcc/gcc/gcc/ada/prj-proc.adb
/test/gnu/gcc/gcc/gcc/ada/prj-proc.ads
/test/gnu/gcc/gcc/gcc/ada/prj.ads
/test/gnu/gcc/gcc/gcc/ada/casing.ads
/test/gnu/gcc/gcc/gcc/ada/types.ads
../rts/unchconv.ads
../rts/unchdeal.ads
/test/gnu/gcc/gcc/gcc/ada/namet.ads
/test/gnu/gcc/gcc/gcc/ada/alloc.ads
/test/gnu/gcc/gcc/gcc/ada/table.ads
/test/gnu/gcc/gcc/gcc/ada/hostparm.ads
/test/gnu/gcc/gcc/gcc/ada/osint.ads
../rts/s-os_lib.ads
../rts/s-string.ads
../rts/ada.ads
../rts/a-uncdea.ads
../rts/s-stoele.ads
/test/gnu/gcc/gcc/gcc/ada/scans.ads
/test/gnu/gcc/gcc/gcc/ada/uintp.ads
/test/gnu/gcc/gcc/gcc/ada/urealp.ads
../rts/gnat.ads
../rts/g-dynhta.ads
../rts/g-dyntab.ads
../rts/g-os_lib.ads
/test/gnu/gcc/gcc/gcc/ada/prj-tree.ads
/test/gnu/gcc/gcc/gcc/ada/prj-attr.ads
../rts/g-string.ads
/test/gnu/gcc/gcc/gcc/ada/prj-env.ads
/test/gnu/gcc/gcc/gcc/ada/prj-ext.ads
/test/gnu/gcc/gcc/gcc/ada/err_vars.ads
/test/gnu/gcc/gcc/gcc/ada/opt.ads
../rts/s-wchcon.ads
/test/gnu/gcc/gcc/gcc/ada/output.ads
/test/gnu/gcc/gcc/gcc/ada/prj-err.ads
/test/gnu/gcc/gcc/gcc/ada/scng.ads
/test/gnu/gcc/gcc/gcc/ada/styleg.ads
/test/gnu/gcc/gcc/gcc/ada/errutil.ads
/test/gnu/gcc/gcc/gcc/ada/prj-nmsc.ads
/test/gnu/gcc/gcc/gcc/ada/prj-part.ads
./snames.ads
../rts/a-string.ads
../rts/a-strfix.ads
../rts/a-strmap.ads
../rts/a-charac.ads
../rts/a-chlat1.ads
../rts/g-casuti.ads
../rts/s-casuti.ads
../rts/g-htable.ads
../rts/s-htable.ads
../rts/s-exctab.ads
../rts/s-stalib.ads
../rts/a-unccon.ads
../rts/s-unstyp.ads
../rts/s-stoele.adb
../rts/a-fihema.ads
../rts/a-finali.ads
../rts/s-finroo.ads
../rts/a-stream.ads
../rts/s-stopoo.ads
../rts/a-tags.ads
../rts/s-soflin.ads
../rts/a-except.ads
../rts/s-parame.ads
../rts/s-traent.ads
../rts/s-stache.ads
../rts/s-secsta.ads
../rts/s-pooglo.ads
../rts/s-assert.ads
../rts/s-imenne.ads
../rts/s-imgboo.ads
../rts/s-htable.adb
../rts/s-strhas.ads


raised TYPES.UNRECOVERABLE_ERROR : comperr.adb:423
make[3]: *** [prj-proc.o] Error 1
make[3]: Leaving directory `/test/gnu/gcc/objdir/gcc/ada/tools'
make[2]: *** [gnattools-native] Error 2
make[2]: Leaving directory `/test/gnu/gcc/objdir/gnattools'
make[1]: *** [all-gnattools] Error 2
make[1]: *** Waiting for unfinished jobs....
Comment 11 Richard Henderson 2011-08-15 17:39:52 UTC
Created attachment 25020 [details]
second patch

Two similar, but not really identical, problems.

S390x should be able to reproduce this second crash, as another
user of anti_adjust_stack within the allocate_stack named pattern.
Perhaps they're not adding Ada to the tested languages...
Comment 12 Richard Henderson 2011-08-15 17:44:19 UTC
Author: rth
Date: Mon Aug 15 17:44:11 2011
New Revision: 177764

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177764
Log:
PR middle-end/50006
        * explow.c (allocate_dynamic_stack_space): Move suppress_reg_args_size
        setting out to include allocate_stack named pattern as well.
        * builtins.c (expand_builtin_apply): Add ARG_SIZE 0 note.
        * stmt.c (expand_stack_restore): Likewise.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/builtins.c
    trunk/gcc/explow.c
    trunk/gcc/stmt.c
Comment 13 Richard Henderson 2011-08-15 17:45:30 UTC
I've committed both patches, as I think they're sufficiently obvious.
Lemme know if we've fixed everything for this target.
Comment 14 Richard Henderson 2011-10-06 22:35:26 UTC
Assuming fixed.  Re-open if not.