Bug 49864 - ICE: in maybe_record_trace_start, at dwarf2cfi.c:2439
Summary: ICE: in maybe_record_trace_start, at dwarf2cfi.c:2439
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Richard Henderson
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks: 34888 49879 49881
  Show dependency treegraph
 
Reported: 2011-07-27 10:48 UTC by Georg-Johann Lay
Modified: 2011-08-26 11:09 UTC (History)
2 users (show)

See Also:
Host:
Target: avr
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-07-27 16:49:56


Attachments
proposed patch (1.11 KB, patch)
2011-07-27 22:17 UTC, Richard Henderson
Details | Diff
assert-i.c (353 bytes, text/plain)
2011-08-24 12:36 UTC, Georg-Johann Lay
Details
followup patch (2.47 KB, patch)
2011-08-24 19:35 UTC, Richard Henderson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Georg-Johann Lay 2011-07-27 10:48:35 UTC
After updating from r176624 to r176818 avr test suite shows a new ICE:

/home/john/gnu/gcc.gnu.org/trunk/gcc/testsuite/gcc.c-torture/unsorted/gen_tst.c: In function 'main_compare':

/home/john/gnu/gcc.gnu.org/trunk/gcc/testsuite/gcc.c-torture/unsorted/gen_tst.c:48:1: internal compiler error: in maybe_record_trace_start, at dwarf2cfi.c:2439

Please submit a full bug report,


FAIL: gcc.c-torture/unsorted/gen_tst.c,  -O3 -g   (internal compiler error)

Executing on host: /local/gnu/build/gcc-trunk-avr/gcc/xgcc -B/local/gnu/build/gcc-trunk-avr/gcc/  -w  -Os   -DSTACK_SIZE=2048 -DNO_TRAMPOLINES -c  -DSIGNAL_SUPPRESS -mmcu=atmega128 -I/home/john/gnu/install/gcc-4.7/avr/include  -o /local/gnu/build/gcc-trunk-avr/gcc/testsuite/gcc/gen_tst.o /home/john/gnu/gcc.gnu.org/trunk/gcc/testsuite/gcc.c-torture/unsorted/gen_tst.c    (timeout = 300)
spawn /local/gnu/build/gcc-trunk-avr/gcc/xgcc -B/local/gnu/build/gcc-trunk-avr/gcc/ -w -Os -DSTACK_SIZE=2048 -DNO_TRAMPOLINES -c -DSIGNAL_SUPPRESS -mmcu=atmega128 -I/home/john/gnu/install/gcc-4.7/avr/include -o /local/gnu/build/gcc-trunk-avr/gcc/testsuite/gcc/gen_tst.o /home/john/gnu/gcc.gnu.org/trunk/gcc/testsuite/gcc.c-torture/unsorted/gen_tst.c


== configure ==

../../gcc.gnu.org/trunk/configure --target=avr --prefix=/local/gnu/install/gcc-4.7 --disable-nls --disable-shared --enable-languages=c,c++ --with-dwarf2 --disable-lto
Comment 1 Richard Henderson 2011-07-27 16:49:56 UTC
Mine.
Comment 2 Richard Henderson 2011-07-27 22:17:47 UTC
Created attachment 24847 [details]
proposed patch

This appears to fix the problem for this testcase.
Please run through a complete regression test to
see how it fares elsewhere.
Comment 3 Richard Henderson 2011-07-28 00:06:16 UTC
Hum, this patch is too hacky and likely to fail for
other targets for different reasons.  We need a more
comprehensive solution.

Consider it withdrawn.
Comment 4 Richard Henderson 2011-08-01 21:43:56 UTC
Current patch:
  http://gcc.gnu.org/ml/gcc-patches/2011-08/msg00075.html
Comment 5 Richard Henderson 2011-08-02 22:18:38 UTC
Author: rth
Date: Tue Aug  2 22:18:35 2011
New Revision: 177218

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177218
Log:
PR target/49864
	* reg-notes.def (REG_ARGS_SIZE): New.
	* calls.c (emit_call_1): Emit REG_ARGS_SIZE for call_pop.
	(expand_call): Add REG_ARGS_SIZE to emit_stack_restore.
	* cfgcleanup.c (old_insns_match_p): Don't allow cross-jumping to
	different stack levels.
	* combine-stack-adj.c (adjust_frame_related_expr): Remove.
	(maybe_move_args_size_note): New.
	(combine_stack_adjustments_for_block): Use it.
	* combine.c (distribute_notes): Place REG_ARGS_SIZE.
	* dwarf2cfi.c (dw_cfi_row_struct): Remove args_size member.
	(dw_trace_info): Add beg_true_args_size, end_true_args_size,
	beg_delay_args_size, end_delay_args_size, eh_head, args_size_undefined.
	(cur_cfa): New.
	(queued_args_size): Remove.
	(add_cfi_args_size): Assert size is non-negative.
	(stack_adjust_offset, dwarf2out_args_size): Remove.
	(dwarf2out_stack_adjust, dwarf2out_notice_stack_adjust): Remove.
	(notice_args_size, notice_eh_throw): New.
	(dwarf2out_frame_debug_def_cfa): Use cur_cfa.
	(dwarf2out_frame_debug_adjust_cfa): Likewise.
	(dwarf2out_frame_debug_cfa_offset): Likewise.
	(dwarf2out_frame_debug_expr): Likewise.  Don't stack_adjust_offset.
	(dwarf2out_frame_debug): Don't handle non-frame-related-p insns.
	(change_cfi_row): Don't emit args_size.
	(maybe_record_trace_start_abnormal): Split out from ...
	(maybe_record_trace_start): Here.  Set args_size_undefined.
	(create_trace_edges): Update to match.
	(scan_trace): Handle REG_ARGS_SIZE.
	(connect_traces): Connect args_size between EH insns.
	* emit-rtl.c (try_split): Handle REG_ARGS_SIZE.
	* explow.c (suppress_reg_args_size): New.
	(adjust_stack_1): Split out from ...
	(adjust_stack): ... here.
	(anti_adjust_stack): Use it.
	(allocate_dynamic_stack_space): Suppress REG_ARGS_SIZE.
	* expr.c (mem_autoinc_base): New.
	(fixup_args_size_notes): New.
	(emit_single_push_insn_1): Rename from emit_single_push_insn.
	(emit_single_push_insn): New.  Generate REG_ARGS_SIZE.
	* recog.c (peep2_attempt): Handle REG_ARGS_SIZE.
	* reload1.c (reload_as_needed): Likewise.
	* rtl.h (fixup_args_size_notes): Declare.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/calls.c
    trunk/gcc/cfgcleanup.c
    trunk/gcc/combine-stack-adj.c
    trunk/gcc/combine.c
    trunk/gcc/dwarf2cfi.c
    trunk/gcc/emit-rtl.c
    trunk/gcc/explow.c
    trunk/gcc/expr.c
    trunk/gcc/recog.c
    trunk/gcc/reg-notes.def
    trunk/gcc/reload1.c
    trunk/gcc/rtl.h
Comment 6 Richard Henderson 2011-08-02 22:19:05 UTC
Fixed.
Comment 7 Georg-Johann Lay 2011-08-24 12:36:57 UTC
Created attachment 25087 [details]
assert-i.c

Set to REOPENED: This bug is still not dead; I see it with r178035 from trunk for the attached, precompiled file from avr-libc.

There are similar PRs PR49994, PR49879 which all are fixed. I chose to reopen this one because it occurs for the same target and similar message.

== Command line ==

avr-gcc assert-i.c -S -Os -g -v

Using built-in specs.
COLLECT_GCC=avr-gcc
COLLECT_LTO_WRAPPER=/local/gnu/install/gcc-4.7/libexec/gcc/avr/4.7.0/lto-wrapper
Target: avr
Configured with: ../../gcc.gnu.org/trunk/configure --target=avr --prefix=/local/gnu/install/gcc-4.7 --disable-nls --disable-shared --enable-languages=c,c++ --with-dwarf2 --disable-lto
Thread model: single
gcc version 4.7.0 20110824 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-S' '-Os' '-g' '-v'
 /local/gnu/install/gcc-4.7/libexec/gcc/avr/4.7.0/cc1 -quiet -v assert-i.c -quiet -dumpbase assert-i.c -auxbase assert-i -g -Os -version -o assert-i.s
GNU C (GCC) version 4.7.0 20110824 (experimental) (avr)
        compiled by GNU C version 4.3.2 [gcc-4_3-branch revision 141291], GMP version 5.0.1, MPFR version 3.0.0-p8, MPC version 0.8.2
...
assert-i.c: In function '__assert':
assert-i.c:36:1: internal compiler error: in maybe_record_trace_start, at dwarf2cfi.c:2234
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 8 Georg-Johann Lay 2011-08-24 12:50:47 UTC
Reopened, changing status from attachement dialog seems to ignore it...
Comment 9 Richard Henderson 2011-08-24 19:35:31 UTC
Created attachment 25091 [details]
followup patch

I think you'd have been better off opening a new bug.

That said, the cross-jumping code needs a bit more restriction to
prevent the introduction of a region with inconsistent stack depth.
This works for the given test case, anyway.
Comment 10 Richard Henderson 2011-08-25 18:57:53 UTC
Author: rth
Date: Thu Aug 25 18:57:48 2011
New Revision: 178084

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=178084
Log:
PR 50132
PR 49864
        * cfgcleanup.c (old_insns_match_p): Don't allow cross-jump for
        non-constant stack adjutment.
        * expr.c (find_args_size_adjust): Break out from ...
        (fixup_args_size_notes): ... here.
        * rtl.h (find_args_size_adjust): Declare.

Added:
    trunk/gcc/testsuite/gcc.dg/pr50132.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgcleanup.c
    trunk/gcc/expr.c
    trunk/gcc/rtl.h
Comment 11 Georg-Johann Lay 2011-08-26 11:09:24 UTC
Thanks Richard. It works again.