[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #32 from Jakub Jelinek jakub at gcc dot gnu.org --- Author: jakub Date: Thu Feb 6 15:52:17 2014 New Revision: 207563 URL: http://gcc.gnu.org/viewcvs?rev=207563root=gccview=rev Log: PR target/59575 * config/arm/arm.c (emit_multi_reg_push): Add dwarf_regs_mask argument, don't record in REG_FRAME_RELATED_EXPR registers not set in that bitmask. (arm_expand_prologue): Adjust all callers. (arm_unwind_emit_sequence): Allow saved, but not important for unwind info, registers also at the lowest numbered registers side. Use gcc_assert instead of abort, and SET_SRC/SET_DEST macros instead of XEXP. * gcc.target/arm/pr59575.c: New test. Modified: trunk/gcc/ChangeLog trunk/gcc/config/arm/arm.c trunk/gcc/testsuite/ChangeLog
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #33 from Jakub Jelinek jakub at gcc dot gnu.org --- Author: jakub Date: Thu Feb 6 15:52:36 2014 New Revision: 207564 URL: http://gcc.gnu.org/viewcvs?rev=207564root=gccview=rev Log: PR target/59575 * config/arm/arm.c (emit_multi_reg_push): Add dwarf_regs_mask argument, don't record in REG_FRAME_RELATED_EXPR registers not set in that bitmask. (arm_expand_prologue): Adjust all callers. (arm_unwind_emit_sequence): Allow saved, but not important for unwind info, registers also at the lowest numbered registers side. Use gcc_assert instead of abort, and SET_SRC/SET_DEST macros instead of XEXP. * gcc.target/arm/pr59575.c: New test. Added: trunk/gcc/testsuite/gcc.target/arm/pr59575.c
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #34 from Jakub Jelinek jakub at gcc dot gnu.org --- Fixed.
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 Richard Henderson rth at gcc dot gnu.org changed: What|Removed |Added Assignee|rth at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #31 from Richard Henderson rth at gcc dot gnu.org --- Whoops, took assignment before I finished reading the log. Jakub has this well in hand. FWIW, the patch looks good to me, but I guess an ARM maintainer should approve it.
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 Richard Biener rguenth at gcc dot gnu.org changed: What|Removed |Added Priority|P3 |P1
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #30 from ktkachov at gcc dot gnu.org --- Patch bootstrapped ok on arm-none-linux-gnueabihf configured --with-arch=armv7-a --with-fpu=neon-vfpv4 --with-mode=thumb --with-float=hard --enable-languages=c,c++,fortran Passed regtest too.
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #22 from Jakub Jelinek jakub at gcc dot gnu.org --- Note, I've even tried: for k in arm thumb; do for j in soft softfp hard; do for i in armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6 armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m armv7-r armv7e-m armv8-a armv8-a+crc iwmmxt iwmmxt2; do ./cc1 -fexceptions pr59575-3.c -fpreprocessed -march=$i -mfloat-abi=$j -quiet -m$k; done; done; done to see if #c18 ICE can be reproduced, but none of the combinations ICEd.
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #23 from Ryan Mansfield rmansfield at qnx dot com --- (In reply to Jakub Jelinek from comment #21) Can you break gen_rtx_fmt_E_stat if code == SEQUENCE and see where this SEQUENCE has been allocated and why the count is so bogusly high? #1 0x00c110a2 in emit_multi_reg_push (mask=18480, dwarf_regs_mask=18480) at ../../gcc/config/arm/arm.c:19645 19645 dwarf = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (num_dwarf_regs + 1)); (gdb) p debug_rtx(dwarf) (sequence [ (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) ]) (gdb) p num_dwarf_regs $7 = 44 I've made sure my sandbox is clean, and that I only have rev207207 + your second patch applied.
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #24 from Ryan Mansfield rmansfield at qnx dot com --- $ valgrind ./cc1 -fexceptions ~/conftest.c ==5295== Memcheck, a memory error detector ==5295== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. ==5295== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==5295== Command: ./cc1 -fexceptions /home/ryan/conftest.c ==5295== foo Analyzing compilation unit Performing interprocedural optimizations *free_lang_data visibility early_local_cleanups *free_inline_summary whole-program inlineAssembling functions: foo==5295== Conditional jump or move depends on uninitialised value(s) ==5295==at 0x82E9C4: mark_pseudo_regno_live(int) (sparseset.h:147) ==5295==by 0x82FB2C: process_bb_node_lives(ira_loop_tree_node*) (ira-lives.c:1321) ==5295==by 0x8154ED: ira_traverse_loop_tree(bool, ira_loop_tree_node*, void (*)(ira_loop_tree_node*), void (*)(ira_loop_tree_node*)) (ira-build.c:1831) ==5295==by 0x830621: ira_create_allocno_live_ranges() (ira-lives.c:1610) ==5295==by 0x816F7C: ira_build() (ira-build.c:3431) ==5295==by 0x80F621: (anonymous namespace)::pass_ira::execute() (ira.c:5311) ==5295==by 0x8B8BC1: execute_one_pass(opt_pass*) (passes.c:2229) ==5295==by 0x8B8E95: execute_pass_list(opt_pass*) (passes.c:2282) ==5295==by 0x8B8EA7: execute_pass_list(opt_pass*) (passes.c:2283) ==5295==by 0x642768: expand_function(cgraph_node*) (cgraphunit.c:1764) ==5295==by 0x644BFF: compile() (cgraphunit.c:1996) ==5295==by 0x644F19: finalize_compilation_unit() (cgraphunit.c:2319) ==5295== ==5295== Conditional jump or move depends on uninitialised value(s) ==5295==at 0x82E8AE: make_object_born(ira_object*) (sparseset.h:147) ==5295==by 0x82E9E1: mark_pseudo_regno_live(int) (ira-lives.c:294) ==5295==by 0x82FB2C: process_bb_node_lives(ira_loop_tree_node*) (ira-lives.c:1321) ==5295==by 0x8154ED: ira_traverse_loop_tree(bool, ira_loop_tree_node*, void (*)(ira_loop_tree_node*), void (*)(ira_loop_tree_node*)) (ira-build.c:1831) ==5295==by 0x830621: ira_create_allocno_live_ranges() (ira-lives.c:1610) ==5295==by 0x816F7C: ira_build() (ira-build.c:3431) ==5295==by 0x80F621: (anonymous namespace)::pass_ira::execute() (ira.c:5311) ==5295==by 0x8B8BC1: execute_one_pass(opt_pass*) (passes.c:2229) ==5295==by 0x8B8E95: execute_pass_list(opt_pass*) (passes.c:2282) ==5295==by 0x8B8EA7: execute_pass_list(opt_pass*) (passes.c:2283) ==5295==by 0x642768: expand_function(cgraph_node*) (cgraphunit.c:1764) ==5295==by 0x644BFF: compile() (cgraphunit.c:1996) ==5295== ==5295== Use of uninitialised value of size 8 ==5295==at 0x82E9C9: mark_pseudo_regno_live(int) (sparseset.h:147) ==5295==by 0x82FB2C: process_bb_node_lives(ira_loop_tree_node*) (ira-lives.c:1321) ==5295==by 0x8154ED: ira_traverse_loop_tree(bool, ira_loop_tree_node*, void (*)(ira_loop_tree_node*), void (*)(ira_loop_tree_node*)) (ira-build.c:1831) ==5295==by 0x830621: ira_create_allocno_live_ranges() (ira-lives.c:1610) ==5295==by 0x816F7C: ira_build() (ira-build.c:3431) ==5295==by 0x80F621: (anonymous namespace)::pass_ira::execute() (ira.c:5311) ==5295==by 0x8B8BC1: execute_one_pass(opt_pass*) (passes.c:2229) ==5295==by 0x8B8E95: execute_pass_list(opt_pass*) (passes.c:2282) ==5295==by 0x8B8EA7: execute_pass_list(opt_pass*) (passes.c:2283) ==5295==by 0x642768: expand_function(cgraph_node*) (cgraphunit.c:1764) ==5295==by 0x644BFF: compile() (cgraphunit.c:1996) ==5295==by 0x644F19: finalize_compilation_unit() (cgraphunit.c:2319) ==5295== ==5295== Use of uninitialised value of size 8 ==5295==at 0x82E900: make_object_born(ira_object*) (sparseset.h:147) ==5295==by 0x82E9E1: mark_pseudo_regno_live(int) (ira-lives.c:294) ==5295==by 0x82FB2C: process_bb_node_lives(ira_loop_tree_node*) (ira-lives.c:1321) ==5295==by 0x8154ED: ira_traverse_loop_tree(bool, ira_loop_tree_node*, void (*)(ira_loop_tree_node*), void (*)(ira_loop_tree_node*)) (ira-build.c:1831) ==5295==by 0x830621: ira_create_allocno_live_ranges() (ira-lives.c:1610) ==5295==by 0x816F7C: ira_build() (ira-build.c:3431) ==5295==by 0x80F621: (anonymous namespace)::pass_ira::execute() (ira.c:5311) ==5295==by 0x8B8BC1: execute_one_pass(opt_pass*) (passes.c:2229) ==5295==by 0x8B8E95: execute_pass_list(opt_pass*) (passes.c:2282) ==5295==by 0x8B8EA7: execute_pass_list(opt_pass*) (passes.c:2283) ==5295==by 0x642768: expand_function(cgraph_node*) (cgraphunit.c:1764) ==5295==by 0x644BFF: compile() (cgraphunit.c:1996) ==5295== ==5295== Conditional jump or move depends on uninitialised value(s) ==5295==at 0x82FDA8: process_bb_node_lives(ira_loop_tree_node*) (sparseset.h:147) ==5295==by 0x8154ED: ira_traverse_loop_tree(bool, ira_loop_tree_node*, void (*)(ira_loop_tree_node*), void (*)(ira_loop_tree_node*)) (ira-build.c:1831) ==5295==by 0x830621:
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #25 from Jakub Jelinek jakub at gcc dot gnu.org --- Created attachment 31980 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=31980action=edit gcc49-pr59575.patch Ah, of course, you're right, num_dwarf_regs is uninitialized. Fixed thusly.
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added Attachment #31943|0 |1 is obsolete|| --- Comment #26 from Jakub Jelinek jakub at gcc dot gnu.org --- Comment on attachment 31943 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=31943 gcc49-pr59575.patch 2014-01-23 Jakub Jelinek ja...@redhat.com PR target/59575 * config/arm/arm.c (emit_multi_reg_push): Add dwarf_regs_mask argument, don't record in REG_FRAME_RELATED_EXPR registers not set in that bitmask. (arm_expand_prologue): Adjust all callers. (arm_unwind_emit_sequence): Allow saved, but not important for unwind info, registers also at the lowest numbered registers side. Use gcc_assert instead of abort, and SET_SRC/SET_DEST macros instead of XEXP. * gcc.target/arm/pr59575.c: New test. --- gcc/config/arm/arm.c.jj2014-01-17 15:16:14.0 +0100 +++ gcc/config/arm/arm.c 2014-01-24 09:16:41.949843665 +0100 @@ -177,7 +177,7 @@ static rtx arm_expand_builtin (tree, rtx static tree arm_builtin_decl (unsigned, bool); static void emit_constant_insn (rtx cond, rtx pattern); static rtx emit_set_insn (rtx, rtx); -static rtx emit_multi_reg_push (unsigned long); +static rtx emit_multi_reg_push (unsigned long, unsigned long); static int arm_arg_partial_bytes (cumulative_args_t, enum machine_mode, tree, bool); static rtx arm_function_arg (cumulative_args_t, enum machine_mode, @@ -19574,9 +19574,11 @@ arm_emit_strd_push (unsigned long saved_ /* Generate and emit an insn that we will recognize as a push_multi. Unfortunately, since this insn does not reflect very well the actual semantics of the operation, we need to annotate the insn for the benefit - of DWARF2 frame unwind information. */ + of DWARF2 frame unwind information. DWARF_REGS_MASK is a subset of + MASK for registers that should be annotated for DWARF2 frame unwind + information. */ static rtx -emit_multi_reg_push (unsigned long mask) +emit_multi_reg_push (unsigned long mask, unsigned long dwarf_regs_mask) { int num_regs = 0; int num_dwarf_regs; @@ -19586,16 +19588,19 @@ emit_multi_reg_push (unsigned long mask) int dwarf_par_index; rtx tmp, reg; + /* We don't record the PC in the dwarf frame information. */ + dwarf_regs_mask = ~(1 PC_REGNUM); + for (i = 0; i = LAST_ARM_REGNUM; i++) -if (mask (1 i)) - num_regs++; +{ + if (mask (1 i)) + num_regs++; + if (dwarf_regs_mask (1 i)) + num_dwarf_regs++; +} gcc_assert (num_regs num_regs = 16); - - /* We don't record the PC in the dwarf frame information. */ - num_dwarf_regs = num_regs; - if (mask (1 PC_REGNUM)) -num_dwarf_regs--; + gcc_assert ((dwarf_regs_mask ~mask) == 0); /* For the body of the insn we are going to generate an UNSPEC in parallel with several USEs. This allows the insn to be recognized @@ -19661,14 +19666,13 @@ emit_multi_reg_push (unsigned long mask) gen_rtvec (1, reg), UNSPEC_PUSH_MULT)); -if (i != PC_REGNUM) +if (dwarf_regs_mask (1 i)) { tmp = gen_rtx_SET (VOIDmode, gen_frame_mem (SImode, stack_pointer_rtx), reg); RTX_FRAME_RELATED_P (tmp) = 1; -XVECEXP (dwarf, 0, dwarf_par_index) = tmp; -dwarf_par_index++; +XVECEXP (dwarf, 0, dwarf_par_index++) = tmp; } break; @@ -19683,7 +19687,7 @@ emit_multi_reg_push (unsigned long mask) XVECEXP (par, 0, j) = gen_rtx_USE (VOIDmode, reg); -if (i != PC_REGNUM) +if (dwarf_regs_mask (1 i)) { tmp = gen_rtx_SET (VOIDmode, @@ -20690,7 +20694,7 @@ arm_expand_prologue (void) /* Interrupt functions must not corrupt any registers. Creating a frame pointer however, corrupts the IP register, so we must push it first. */ -emit_multi_reg_push (1 IP_REGNUM); +emit_multi_reg_push (1 IP_REGNUM, 1 IP_REGNUM); /* Do not set RTX_FRAME_RELATED_P on this insn. The dwarf stack unwinding code only wants to see one @@ -20751,7 +20755,8 @@ arm_expand_prologue (void) if (cfun-machine-uses_anonymous_args) { insn - = emit_multi_reg_push ((0xf0 (args_to_push / 4)) 0xf); + = emit_multi_reg_push ((0xf0 (args_to_push / 4)) 0xf, + (0xf0 (args_to_push / 4)) 0xf); emit_set_insn (gen_rtx_REG (SImode, 3), ip_rtx);
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #27 from Ryan Mansfield rmansfield at qnx dot com --- (In reply to Jakub Jelinek from comment #25) Created attachment 31980 [details] gcc49-pr59575.patch Ah, of course, you're right, num_dwarf_regs is uninitialized. Fixed thusly. Yep, that fixes the ICE. Thanks
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #28 from Jakub Jelinek jakub at gcc dot gnu.org --- (In reply to Ryan Mansfield from comment #27) Yep, that fixes the ICE. Thanks Could you please bootstrap/regtest it if you have hw for that?
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #29 from Ryan Mansfield rmansfield at qnx dot com --- (In reply to Jakub Jelinek from comment #28) (In reply to Ryan Mansfield from comment #27) Yep, that fixes the ICE. Thanks Could you please bootstrap/regtest it if you have hw for that? Yep, I can, it just will take me a bit as I don't have an arm-unknown-linux-gnueabi up and running right now. I found this original ICE on an (unsupported) qnx armeabi target.
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #20 from Ryan Mansfield rmansfield at qnx dot com --- Sorry, can't reproduce. Can you run it in the debugger p debug_rtx (p) up p debug_rtx (insn) ? Sorry for the delay. Starting program: /home/ryan/gnu/gcc/trunk/arm-eabi/gcc/./cc1 -fexceptions /home/ryan/conftest.c foo Analyzing compilation unit Performing interprocedural optimizations *free_lang_data visibility early_local_cleanups *free_inline_summary whole-program inlineAssembling functions: foo Program received signal SIGSEGV, Segmentation fault. 0x00c285e2 in arm_unwind_emit_sequence (asm_out_file=0x165d930, p=0x76dd20a0) at ../../gcc/config/arm/arm.c:28728 28728 e = XEXP (SET_DEST (e), 0); (gdb) p debug_rtx(p) (sequence [ (set/f (reg/f:SI 13 sp) (plus:SI (reg/f:SI 13 sp) (const_int -16 [0xfff0]))) (set/f (mem/c:SI (reg/f:SI 13 sp) [0 S4 A32]) (reg:SI 4 r4)) (set/f (mem/c:SI (plus:SI (reg/f:SI 13 sp) (const_int 4 [0x4])) [0 S4 A32]) (reg:SI 5 r5)) (set/f (mem/c:SI (plus:SI (reg/f:SI 13 sp) (const_int 8 [0x8])) [0 S4 A32]) (reg/f:SI 11 fp)) (set/f (mem/c:SI (plus:SI (reg/f:SI 13 sp) (const_int 12 [0xc])) [0 S4 A32]) (reg:SI 14 lr)) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) ]) $2 = void (gdb) up #1 0x00c2905e in arm_unwind_emit (asm_out_file=0x165d930, insn=0x76dd31f8) at ../../gcc/config/arm/arm.c:28969 28969 arm_unwind_emit_sequence (asm_out_file, pat); (gdb) p debug_rtx(insn) (insn/f 65 3 66 (parallel [ (set (mem/c:BLK (pre_modify:SI (reg/f:SI 13 sp) (plus:SI (reg/f:SI 13 sp) (const_int -16 [0xfff0]))) [0 A8]) (unspec:BLK [ (reg:SI 4 r4) ] UNSPEC_PUSH_MULT)) (use (reg:SI 5 r5)) (use (reg/f:SI 11 fp)) (use (reg:SI 14 lr)) ]) /home/ryan/conftest.c:4 341 {*push_multi} (expr_list:REG_FRAME_RELATED_EXPR (sequence [ (set/f (reg/f:SI 13 sp) (plus:SI (reg/f:SI 13 sp) (const_int -16 [0xfff0]))) (set/f (mem/c:SI (reg/f:SI 13 sp) [0 S4 A32]) (reg:SI 4 r4)) (set/f (mem/c:SI (plus:SI (reg/f:SI 13 sp) (const_int 4 [0x4])) [0 S4 A32]) (reg:SI 5 r5)) (set/f (mem/c:SI (plus:SI (reg/f:SI 13 sp) (const_int 8 [0x8])) [0 S4 A32]) (reg/f:SI 11 fp)) (set/f (mem/c:SI (plus:SI (reg/f:SI 13 sp) (const_int 12 [0xc])) [0 S4 A32]) (reg:SI 14 lr)) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) (nil) ]) (nil))) $3 = void
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #21 from Jakub Jelinek jakub at gcc dot gnu.org --- Can you break gen_rtx_fmt_E_stat if code == SEQUENCE and see where this SEQUENCE has been allocated and why the count is so bogusly high?
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #19 from Jakub Jelinek jakub at gcc dot gnu.org --- (In reply to Ryan Mansfield from comment #18) (In reply to Jakub Jelinek from comment #17) Can I ask for preprocessed source + options again? $ cat ~/conftest.c void bar (); void clean (int *); void foo () { int i __attribute__ ((cleanup (clean))); bar(); } ryan@zoidberg:~/gnu/gcc/trunk/arm-eabi/gcc$ ./xgcc -B. -fexceptions ~/conftest.c /home/ryan/conftest.c: In function 'foo': /home/ryan/conftest.c:7:1: internal compiler error: Segmentation fault } ^ 0x95cbcf crash_signal ../../gcc/toplev.c:337 0xbef5a6 arm_unwind_emit_sequence ../../gcc/config/arm/arm.c:28729 0xbef5a6 arm_unwind_emit ../../gcc/config/arm/arm.c:28970 0x708ede final_scan_insn(rtx_def*, _IO_FILE*, int, int, int*) ../../gcc/final.c:2978 0x709885 final(rtx_def*, _IO_FILE*, int) ../../gcc/final.c:2024 0x709ca9 rest_of_handle_final ../../gcc/final.c:4438 0x709ca9 execute ../../gcc/final.c:4513 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See http://gcc.gnu.org/bugs.html for instructions. Sorry, can't reproduce. Can you run it in the debugger p debug_rtx (p) up p debug_rtx (insn) ?
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #16 from Ryan Mansfield rmansfield at qnx dot com --- (In reply to Jakub Jelinek from comment #15) Created attachment 31943 [details] gcc49-pr59575.patch Updated patch, which should now handle the dummy pushes also in arm_unwind_emit_sequence. Untested as before, just it doesn't ICE on the source you've attached anymore. Thanks for the patch, but this one ICEs configuring libgcc. e.g. configure:4222: checking whether to use setjmp/longjmp exceptions configure:: /home/ryan/gnu/gcc/trunk/arm-eabi/./gcc/xgcc -B/home/ryan/gnu/gcc/trunk/arm-eabi/./gcc/ -B/home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/bin/ -B/home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/lib/ -isystem /home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/include -isystem /home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sys-include -c --save-temps -fexceptions conftest.c 5 conftest.c: In function 'foo': conftest.c:19:1: internal compiler error: Segmentation fault } ^ 0x95cbcf crash_signal ../../gcc/toplev.c:337 0xbef5a6 arm_unwind_emit_sequence ../../gcc/config/arm/arm.c:28729 0xbef5a6 arm_unwind_emit ../../gcc/config/arm/arm.c:28970 0x708ede final_scan_insn(rtx_def*, _IO_FILE*, int, int, int*) ../../gcc/final.c:2978 0x709885 final(rtx_def*, _IO_FILE*, int) ../../gcc/final.c:2024 0x709ca9 rest_of_handle_final ../../gcc/final.c:4438 0x709ca9 execute ../../gcc/final.c:4513 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See http://gcc.gnu.org/bugs.html for instructions.
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #17 from Jakub Jelinek jakub at gcc dot gnu.org --- Can I ask for preprocessed source + options again?
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #18 from Ryan Mansfield rmansfield at qnx dot com --- (In reply to Jakub Jelinek from comment #17) Can I ask for preprocessed source + options again? $ cat ~/conftest.c void bar (); void clean (int *); void foo () { int i __attribute__ ((cleanup (clean))); bar(); } ryan@zoidberg:~/gnu/gcc/trunk/arm-eabi/gcc$ ./xgcc -B. -fexceptions ~/conftest.c /home/ryan/conftest.c: In function 'foo': /home/ryan/conftest.c:7:1: internal compiler error: Segmentation fault } ^ 0x95cbcf crash_signal ../../gcc/toplev.c:337 0xbef5a6 arm_unwind_emit_sequence ../../gcc/config/arm/arm.c:28729 0xbef5a6 arm_unwind_emit ../../gcc/config/arm/arm.c:28970 0x708ede final_scan_insn(rtx_def*, _IO_FILE*, int, int, int*) ../../gcc/final.c:2978 0x709885 final(rtx_def*, _IO_FILE*, int) ../../gcc/final.c:2024 0x709ca9 rest_of_handle_final ../../gcc/final.c:4438 0x709ca9 execute ../../gcc/final.c:4513 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See http://gcc.gnu.org/bugs.html for instructions.
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added Attachment #31934|0 |1 is obsolete|| --- Comment #15 from Jakub Jelinek jakub at gcc dot gnu.org --- Created attachment 31943 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=31943action=edit gcc49-pr59575.patch Updated patch, which should now handle the dummy pushes also in arm_unwind_emit_sequence. Untested as before, just it doesn't ICE on the source you've attached anymore.
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #8 from Jakub Jelinek jakub at gcc dot gnu.org --- Created attachment 31934 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=31934action=edit gcc49-pr59575.patch Untested fix. Can somebody please test it?
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #7 from Jakub Jelinek jakub at gcc dot gnu.org --- Actually, it seems like the code can push up to 8 of the dummy regs and 4 of them are call saved (but they can be just unused in the function and thus still saved as dummy regs and not restored in the epilogue anywhere and thus shouldn't be visible to the debugger). Thus the only fix seems to me is to add the extra bitmask argument to the 3 calls. I've done that in the patch I'll attach, though it is completely untested and I don't have easy access to some box where I could test it. Also note that I think 2 of the 3 actually may generate more than one instruction for the push, but still pretend the first instruction adjusts the stack pointer by what all the instructions do together and pretends to save all registers, that looks wrong to me, but I haven't tried to do anything about it. I'd say each of the insns should get it's own REG_FRAME_RELATED_EXPR describing what that particular instruction actually does that CFI cares about (i.e. stack adjustment (by 4 or 8 bytes?)) and which (if any) dwarf_cfa_mask mentioned regs are saved in that particular instruction.
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #9 from Ryan Mansfield rmansfield at qnx dot com --- (In reply to Jakub Jelinek from comment #8) Created attachment 31934 [details] gcc49-pr59575.patch Untested fix. Can somebody please test it? The attached patch fixes the original ICE but introduces a new one. -I../../../libgcc/../include -DHAVE_CC_TLS -o unwind-c.o -MT unwind-c.o -MD -MP -MF unwind-c.dep -fexceptions -c ../../../libgcc/unwind-c.c -fvisibility=hidden -DHIDE_EXPORTS ../../../libgcc/unwind-arm-common.inc:275:1: internal compiler error: in arm_unwind_emit_sequence, at config/arm/arm.c:28777 } ^ 0xbef8a5 arm_unwind_emit_sequence ../../gcc/config/arm/arm.c:28777 0xbef8a5 arm_unwind_emit ../../gcc/config/arm/arm.c:28999 0x708bde final_scan_insn(rtx_def*, _IO_FILE*, int, int, int*) ../../gcc/final.c:2978 0x709585 final(rtx_def*, _IO_FILE*, int) ../../gcc/final.c:2024 0x7099a9 rest_of_handle_final ../../gcc/final.c:4438 0x7099a9 execute ../../gcc/final.c:4513 Please submit a full bug report, with preprocessed source if appropriate.
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #10 from Jakub Jelinek jakub at gcc dot gnu.org --- (In reply to Ryan Mansfield from comment #9) (In reply to Jakub Jelinek from comment #8) Created attachment 31934 [details] gcc49-pr59575.patch Untested fix. Can somebody please test it? The attached patch fixes the original ICE but introduces a new one. -I../../../libgcc/../include -DHAVE_CC_TLS -o unwind-c.o -MT unwind-c.o -MD -MP -MF unwind-c.dep -fexceptions -c ../../../libgcc/unwind-c.c -fvisibility=hidden -DHIDE_EXPORTS ../../../libgcc/unwind-arm-common.inc:275:1: internal compiler error: in arm_unwind_emit_sequence, at config/arm/arm.c:28777 } ^ 0xbef8a5 arm_unwind_emit_sequence ../../gcc/config/arm/arm.c:28777 0xbef8a5 arm_unwind_emit ../../gcc/config/arm/arm.c:28999 0x708bde final_scan_insn(rtx_def*, _IO_FILE*, int, int, int*) ../../gcc/final.c:2978 0x709585 final(rtx_def*, _IO_FILE*, int) ../../gcc/final.c:2024 0x7099a9 rest_of_handle_final ../../gcc/final.c:4438 0x7099a9 execute ../../gcc/final.c:4513 Please submit a full bug report, with preprocessed source if appropriate. Can you please attach unwind-c.i ? What exact options is it compiled with (including whatever -march/float abi/etc. is needed to reproduce on say --target armv5tel-unknown-linux-gnueabi configured gcc)? I'm surprised it would affect arm unwind info, but perhaps I've made a bug in the patch somewhere.
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #11 from Ryan Mansfield rmansfield at qnx dot com --- Created attachment 31937 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=31937action=edit preprocessed src Configured with: ../configure --target=arm-unknown-linux-gnueabi --prefix=/home/ryan/x-tools/arm-unknown-linux-gnueabi --with-sysroot=/home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi//sys-root --disable-multilib --with-local-prefix=/home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sys-root --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-c99 --enable-long-long --enable-target-optspace target_alias=arm-unknown-linux-gnueabi --enable-languages=c++ --disable-shared --disable-libmudflap --disable-libssp --enable-checking Thread model: posix gcc version 4.9.0 20140123 (experimental) [trunk revision 206976] (GCC)
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #12 from Ryan Mansfield rmansfield at qnx dot com --- /home/ryan/gnu/gcc/trunk/arm-eabi/./gcc/xgcc -B/home/ryan/gnu/gcc/trunk/arm-eabi/./gcc/ -B/home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/bin/ -B/home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/lib/ -isystem /home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/include -isystem /home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sys-include -g -Os -O2 -g -Os -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -fno-inline -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fPIC -fno-inline -I. -I. -I../.././gcc -I../../../libgcc -I../../../libgcc/. -I../../../libgcc/../gcc -I../../../libgcc/../include -DHAVE_CC_TLS -o pr-support.o -MT pr-support.o -MD -MP -MF pr-support.dep -fexceptions -c ../../../libgcc/config/arm/pr-support.c -fvisibility=hidden -DHIDE_EXPORTS In file included from ./unwind.h:30:0, from ../../../libgcc/config/arm/pr-support.c:24: /home/ryan/gnu/gcc/trunk/arm-eabi/gcc/include/unwind-arm-common.h: In function '_Unwind_GetGR.constprop': /home/ryan/gnu/gcc/trunk/arm-eabi/gcc/include/unwind-arm-common.h:225:5: internal compiler error: in arm_unwind_emit_sequence, at config/arm/arm.c:28777 } ^ 0xbef8a5 arm_unwind_emit_sequence ../../gcc/config/arm/arm.c:28777 0xbef8a5 arm_unwind_emit ../../gcc/config/arm/arm.c:28999 0x708bde final_scan_insn(rtx_def*, _IO_FILE*, int, int, int*) ../../gcc/final.c:2978 0x709585 final(rtx_def*, _IO_FILE*, int) ../../gcc/final.c:2024 0x7099a9 rest_of_handle_final ../../gcc/final.c:4438 0x7099a9 execute ../../gcc/final.c:4513 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See http://gcc.gnu.org/bugs.html for instructions. ../../../libgcc/static-object.mk:17: recipe for target 'pr-support.o' failed make: *** [pr-support.o] Error 1
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #13 from Jakub Jelinek jakub at gcc dot gnu.org --- (In reply to Ryan Mansfield from comment #12) /home/ryan/gnu/gcc/trunk/arm-eabi/./gcc/xgcc -B/home/ryan/gnu/gcc/trunk/arm-eabi/./gcc/ -B/home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/bin/ -B/home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/lib/ -isystem /home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/ include -isystem /home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sys- include-g -Os -O2 -g -Os -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -fno-inline -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fPIC -fno-inline -I. -I. -I../.././gcc -I../../../libgcc -I../../../libgcc/. -I../../../libgcc/../gcc -I../../../libgcc/../include -DHAVE_CC_TLS -o pr-support.o -MT pr-support.o -MD -MP -MF pr-support.dep -fexceptions -c ../../../libgcc/config/arm/pr-support.c -fvisibility=hidden -DHIDE_EXPORTS In file included from ./unwind.h:30:0, from ../../../libgcc/config/arm/pr-support.c:24: /home/ryan/gnu/gcc/trunk/arm-eabi/gcc/include/unwind-arm-common.h: In function '_Unwind_GetGR.constprop': /home/ryan/gnu/gcc/trunk/arm-eabi/gcc/include/unwind-arm-common.h:225:5: internal compiler error: in arm_unwind_emit_sequence, at config/arm/arm.c:28777 } ^ 0xbef8a5 arm_unwind_emit_sequence ../../gcc/config/arm/arm.c:28777 0xbef8a5 arm_unwind_emit ../../gcc/config/arm/arm.c:28999 0x708bde final_scan_insn(rtx_def*, _IO_FILE*, int, int, int*) ../../gcc/final.c:2978 0x709585 final(rtx_def*, _IO_FILE*, int) ../../gcc/final.c:2024 0x7099a9 rest_of_handle_final ../../gcc/final.c:4438 0x7099a9 execute ../../gcc/final.c:4513 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See http://gcc.gnu.org/bugs.html for instructions. ../../../libgcc/static-object.mk:17: recipe for target 'pr-support.o' failed make: *** [pr-support.o] Error 1 Ah, ok, I see, arm_unwind_emit_sequence is being passed the REG_FRAME_RELATED_EXPR sequence. So, I guess the primary question is, do you want to emit: stmfd sp!, {r0, r1, r2, r4, r5, lr} .save {r0, r1, r2, r4, r5, lr} or: stmfd sp!, {r0, r1, r2, r4, r5, lr} .save {r4, r5, lr} .pad #12 when r0/r1/r2 have been added just to align the thing? For the latter case (which I think is conceptually better, the r0/r1/r2 really don't need to be saved) I think it would be enough just to look at the sp offsets where each register is saved and figure out the gaps. Before my patch the only gap could be PC register as the topmost one. With my patch there can be also a gap at the very bottom. Anyway, it would be nice to hear ARM maintainers about this.
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #14 from Jakub Jelinek jakub at gcc dot gnu.org --- Oh, one more thing, supposedly I could have left the thumb2_emit_strd_push and arm_emit_strd_push functions unmodified, because the addition of extra low registers to live_reg_mask is guarded with optimize_size, and the above mentioned two functions are only called if !optimize_function_for_size_p (cfun) (and that function returns always true for optimize_size).
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added CC||jakub at gcc dot gnu.org, ||ramana at gcc dot gnu.org, ||rearnsha at gcc dot gnu.org --- Comment #6 from Jakub Jelinek jakub at gcc dot gnu.org --- The #c1 to #c5 comments are completely unrelated to the #c0 issue, which is clearly a bug in the ARM backend. When creating prologue, the ARM backend decides to save some garbage registers (just to avoid having to decrement stack pointer separately?): if (optimize_size !frame_pointer_needed saved_regs == offsets-saved_regs - offsets-saved_args) { /* If no coprocessor registers are being pushed and we don't have to worry about a frame pointer then push extra registers to create the stack frame. This is done is a way that does not alter the frame layout, so is independent of the epilogue. */ int n; int frame; n = 0; while (n 8 (live_regs_mask (1 n)) == 0) n++; frame = offsets-outgoing_args - (offsets-saved_args + saved_regs); if (frame n * 4 = frame) { n = frame / 4; live_regs_mask |= (1 n) - 1; saved_regs += frame; } } so without -g we get: stmfd sp!, {r0, r1, r2, lr} in the prologue (note, this is shrink wrapped) and add sp, sp, #12 @ sp needed ldr lr, [sp], #4 in the epilogue (note, r0-r2 not restored there). This is all fine, except that the emit_multi_reg_push/arm_emit_strd_push/thumb2_emit_strd_push all record all those saved registers into REG_FRAME_RELATED_EXPR, which is a very bad idea. Only call clobbered registers that you actually save in prologue and restore in epilogue should be declared as saved for CFI purposes, the dwarf2cfi.c code verifies this property and that's the reason for this ICE. Now, I'm afraid I'm not familiar enough with the multitude of ARM ABIs, so not sure if the best fix is just to ignore for the REG_FRAME_RELATED_EXPR in those 3 above mentioned functions all non-fixed call_used registers, just ignore r0..r3, or if the caller should call those functions with two masks, one for what registers should be actually saved to the stack (as right now) and another for which registers should be in REG_FRAME_RELATED_EXPR (equal to the first or some subset thereof).
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 Richard Biener rguenth at gcc dot gnu.org changed: What|Removed |Added Target Milestone|--- |4.9.0
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 Jan Hubicka hubicka at gcc dot gnu.org changed: What|Removed |Added CC||rth at gcc dot gnu.org --- Comment #2 from Jan Hubicka hubicka at gcc dot gnu.org --- On x86-64 the problem is iteration of crossjumping and dwarf2cfi. We introduce: (insn:TI 559 558 2420 38 (set (mem:SI (pre_dec:SI (reg/f:SI 7 sp)) [0 S4 A8]) (reg/f:SI 6 bp [orig:159 bs ] [159])) ../../../../libgo/go/encoding/binary/binary.go:263 66 {*pushsi2} (expr_list:REG_ARGS_SIZE (const_int 28 [0x1c]) (nil))) (code_label 2420 559 2418 39 722 [1 uses]) (note 2418 2420 772 39 [bb 39] NOTE_INSN_BASIC_BLOCK) (insn:TI 772 2418 773 39 (set (mem/f:SI (pre_dec:SI (reg/f:SI 7 sp)) [6 S4 A32]) (mem/c:SI (plus:SI (reg/f:SI 7 sp) (const_int 64 [0x40])) [57 %sfp+-220 S4 A32])) ../../../../libgo/go/encoding/binary/binary.go:273 66 {*pushsi2} (expr_list:REG_ARGS_SIZE (const_int 32 [0x20]) (nil))) (call_insn:TI 773 772 774 39 (call (mem:QI (reg/f:SI 0 ax [orig:233 D.6194 ] [233]) [0 S1 A8]) (const_int 32 [0x20])) ../../../../libgo/go/encoding/binary/binary.go:273 672 {*call} (expr_list:REG_DEAD (reg/f:SI 0 ax [orig:233 D.6194 ] [233]) (nil)) (nil)) (insn:TI 774 773 100 39 (parallel [ (set (reg/f:SI 7 sp) (plus:SI (reg/f:SI 7 sp) (const_int 32 [0x20]))) (clobber (reg:CC 17 flags)) (clobber (reg:CC 17 flags)) ]) ../../../../libgo/go/encoding/binary/binary.go:273 265 {*addsi_1} (expr_list:REG_UNUSED (reg:CC 17 flags) (expr_list:REG_ARGS_SIZE (const_int 0 [0]) (nil (insn 100 774 101 39 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp) (const_int 24 [0x18])) [57 %sfp+-232 S4 A32]) (const_int 8 [0x8])) ../../../../libgo/go/encoding/binary/binary.go:272 90 {*movsi_internal} (nil)) (insn 101 100 2682 39 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp) (const_int 12 [0xc])) [57 %sfp+-244 S4 A32]) (const_int 2 [0x2])) ../../../../libgo/go/encoding/binary/binary.go:272 90 {*movsi_internal} (nil)) (jump_insn:TI 2682 101 2683 39 (set (pc) (label_ref 1634)) 667 {jump} (nil) - 1634) dwarf2cfi is apparently not able to merge these calls since they have different stack pointers at that time: (gdb) p *ti-beg_row $7 = {cfa = {offset = 316, base_offset = 0, reg = 4, indirect = 0, in_use = 0}, cfa_cfi = 0x0, reg_save = 0x76f7ecd0} (gdb) p *cur_row $8 = {cfa = {offset = 304, base_offset = 0, reg = 4, indirect = 0, in_use = 0}, cfa_cfi = 0x0, reg_save = 0x76f9f730} (gdb) I am not quite sure why they are different, since the calls both leads to normal return and seem to expect sp to be sane.
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #3 from Jan Hubicka hubicka at gcc dot gnu.org --- First block is: (insn:TI 551 2434 552 38 (set (mem/f/c:SI (plus:SI (reg/f:SI 7 sp) (const_int 104 [0x68])) [17 MEM[(struct *)bs]+0 S4 A64]) (reg/f:SI 6 bp [orig:159 bs ] [159])) ../../../../libgo/go/encoding/binary/binary.go:263 90 {*movsi_internal} (nil)) (insn 552 551 553 38 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp) (const_int 108 [0x6c])) [17 MEM[(struct *)bs + 4B]+0 S4 A32]) (const_int 2 [0x2])) ../../../../libgo/go/encoding/binary/binary.go:263 90 {*movsi_internal} (nil)) (insn:TI 553 552 556 38 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp) (const_int 112 [0x70])) [17 MEM[(struct *)bs + 8B]+0 S4 A64]) (const_int 8 [0x8])) ../../../../libgo/go/encoding/binary/binary.go:263 90 {*movsi_internal} (nil)) (insn 556 553 557 38 (set (mem:HI (reg/f:SI 7 sp) [49 S2 A16]) (reg/v:HI 1 dx [orig:202 v ] [202])) ../../../../libgo/go/encoding/binary/binary.go:263 91 {*movhi_internal} (expr_list:REG_DEAD (reg/v:HI 1 dx [orig:202 v ] [202]) (expr_list:REG_ARGS_SIZE (const_int 16 [0x10]) (nil (insn:TI 557 556 558 38 (set (mem:SI (pre_dec:SI (reg/f:SI 7 sp)) [0 S4 A8]) (const_int 8 [0x8])) ../../../../libgo/go/encoding/binary/binary.go:263 66 {*pushsi2} (expr_list:REG_ARGS_SIZE (const_int 20 [0x14]) (nil))) (insn 558 557 559 38 (set (mem:SI (pre_dec:SI (reg/f:SI 7 sp)) [0 S4 A8]) (const_int 2 [0x2])) ../../../../libgo/go/encoding/binary/binary.go:263 66 {*pushsi2} (expr_list:REG_ARGS_SIZE (const_int 24 [0x18]) (nil))) (insn:TI 559 558 2420 38 (set (mem:SI (pre_dec:SI (reg/f:SI 7 sp)) [0 S4 A8]) (reg/f:SI 6 bp [orig:159 bs ] [159])) ../../../../libgo/go/encoding/binary/binary.go:263 66 {*pushsi2} (expr_list:REG_ARGS_SIZE (const_int 28 [0x1c]) (nil))) Second is: (code_label 2425 707 2423 54 723 [1 uses]) (note 2423 2425 760 54 [bb 54] NOTE_INSN_BASIC_BLOCK) (insn:TI 760 2423 761 54 (set (mem/f/c:SI (plus:SI (reg/f:SI 7 sp) (const_int 104 [0x68])) [17 MEM[(struct *)bs]+0 S4 A64]) (reg/f:SI 6 bp [orig:159 bs ] [159])) ../../../../libgo/go/encoding/binary/binary.go:273 90 {*movsi_internal} (nil)) (insn 761 760 766 54 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp) (const_int 108 [0x6c])) [17 MEM[(struct *)bs + 4B]+0 S4 A32]) (const_int 2 [0x2])) ../../../../libgo/go/encoding/binary/binary.go:273 90 {*movsi_internal} (nil)) (insn 766 761 762 54 (parallel [ (set (reg/f:SI 7 sp) (plus:SI (reg/f:SI 7 sp) (const_int -12 [0xfff4]))) (clobber (reg:CC 17 flags)) ]) ../../../../libgo/go/encoding/binary/binary.go:273 265 {*addsi_1} (expr_list:REG_UNUSED (reg:CC 17 flags) (expr_list:REG_ARGS_SIZE (const_int 28 [0x1c]) (nil (insn:TI 762 766 765 54 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp) (const_int 124 [0x7c])) [17 MEM[(struct *)bs + 8B]+0 S4 A64]) (const_int 8 [0x8])) ../../../../libgo/go/encoding/binary/binary.go:273 90 {*movsi_internal} (nil)) (insn 765 762 770 54 (set (mem:HI (plus:SI (reg/f:SI 7 sp) (const_int 12 [0xc])) [49 S2 A16]) (reg/v:HI 1 dx [orig:232 v ] [232])) ../../../../libgo/go/encoding/binary/binary.go:273 91 {*movhi_internal} (expr_list:REG_DEAD (reg/v:HI 1 dx [orig:232 v ] [232]) (expr_list:REG_ARGS_SIZE (const_int 16 [0x10]) (nil (insn 770 765 2326 54 (set (reg:SI 2 cx [488]) (const_int 3 [0x3])) ../../../../libgo/go/encoding/binary/binary.go:273 90 {*movsi_internal} (expr_list:REG_EQUAL (const_int 3 [0x3]) (nil))) (insn:TI 2326 770 2023 54 (set (reg:SI 4 si [487]) (plus:SI (reg/f:SI 7 sp) (const_int 116 [0x74]))) ../../../../libgo/go/encoding/binary/binary.go:273 258 {*leasi} (nil)) (insn 2023 2326 771 54 (set (reg/f:SI 5 di [486]) (reg/f:SI 7 sp)) ../../../../libgo/go/encoding/binary/binary.go:273 90 {*movsi_internal} (nil)) (insn:TI 771 2023 2693 54 (parallel [ (set (reg:SI 2 cx [488]) (const_int 0 [0])) (set (reg/f:SI 5 di [486]) (plus:SI (ashift:SI (reg:SI 2 cx [488]) (const_int 2 [0x2])) (reg/f:SI 5 di [486]))) (set (reg:SI 4 si [487]) (plus:SI (ashift:SI (reg:SI 2 cx [488]) (const_int 2 [0x2])) (reg:SI 4 si [487]))) (set (mem:BLK (reg/f:SI 5 di [486]) [0 S12 A32]) (mem/c:BLK (reg:SI 4 si [487]) [17 bs+0 S12 A64])) (use (reg:SI 2 cx [488])) ]) ../../../../libgo/go/encoding/binary/binary.go:273 921 {*rep_movsi} (expr_list:REG_UNUSED (reg/f:SI 5 di [486]) (expr_list:REG_UNUSED (reg:SI 4
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #4 from Jan Hubicka hubicka at gcc dot gnu.org --- OK, sched2 reorders: (insn 762 761 765 50 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp) (const_int 112 [0x70])) [17 MEM[(struct *)bs + 8B]+0 S4 A64]) (const_int 8 [0x8])) ../../../../libgo/go/encoding/binary/binary.go:273 90 {*movsi_internal} (nil)) (insn 765 762 766 50 (set (mem:HI (reg/f:SI 7 sp) [49 S2 A16]) (reg/v:HI 1 dx [orig:232 v ] [232])) ../../../../libgo/go/encoding/binary/binary.go:273 91 {*movhi_internal} (expr_list:REG_DEAD (reg/v:HI 1 dx [orig:232 v ] [232]) (expr_list:REG_ARGS_SIZE (const_int 16 [0x10]) (nil (insn 766 765 2326 50 (parallel [ (set (reg/f:SI 7 sp) (plus:SI (reg/f:SI 7 sp) (const_int -12 [0xfff4]))) (clobber (reg:CC 17 flags)) ]) ../../../../libgo/go/encoding/binary/binary.go:273 265 {*addsi_1} (expr_list:REG_UNUSED (reg:CC 17 flags) (expr_list:REG_ARGS_SIZE (const_int 28 [0x1c]) (nil to (insn 766 761 762 54 (parallel [ (set (reg/f:SI 7 sp) (plus:SI (reg/f:SI 7 sp) (const_int -12 [0xfff4]))) (clobber (reg:CC 17 flags)) ]) ../../../../libgo/go/encoding/binary/binary.go:273 265 {*addsi_1} (expr_list:REG_UNUSED (reg:CC 17 flags) (expr_list:REG_ARGS_SIZE (const_int 28 [0x1c]) (nil (insn:TI 762 766 765 54 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp) (const_int 124 [0x7c])) [17 MEM[(struct *)bs + 8B]+0 S4 A64]) (const_int 8 [0x8])) ../../../../libgo/go/encoding/binary/binary.go:273 90 {*movsi_internal} (nil)) (insn 765 762 770 54 (set (mem:HI (plus:SI (reg/f:SI 7 sp) (const_int 12 [0xc])) [49 S2 A16]) (reg/v:HI 1 dx [orig:232 v ] [232])) ../../../../libgo/go/encoding/binary/binary.go:273 91 {*movhi_internal} (expr_list:REG_DEAD (reg/v:HI 1 dx [orig:232 v ] [232]) (expr_list:REG_ARGS_SIZE (const_int 16 [0x10]) (nil Here insn 765 gets adjusted for insn766 wihtout updating REG_ARGS_SIZE. I guess it is because REG_ARGS_SIZE is supposed to sit on insn adjust the stack. Insn 765 looks as follows: (insn 762 761 763 50 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp) (const_int 112 [0x70])) [17 MEM[(struct *)bs + 8B]+0 S4 A64]) (const_int 8 [0x8])) ../../../../libgo/go/encoding/binary/binary.go:273 90 {*movsi_internal} (nil)) (insn 763 762 764 50 (parallel [ (set (reg/f:SI 7 sp) (plus:SI (reg/f:SI 7 sp) (const_int 16 [0x10]))) (clobber (reg:CC 17 flags)) ]) ../../../../libgo/go/encoding/binary/binary.go:273 265 {*addsi_1} (expr_list:REG_UNUSED (reg:CC 17 flags) (expr_list:REG_ARGS_SIZE (const_int 0 [0]) (nil (insn 764 763 765 50 (parallel [ (set (reg/f:SI 7 sp) (plus:SI (reg/f:SI 7 sp) (const_int -12 [0xfff4]))) (clobber (reg:CC 17 flags)) ]) ../../../../libgo/go/encoding/binary/binary.go:273 265 {*addsi_1} (expr_list:REG_UNUSED (reg:CC 17 flags) (expr_list:REG_ARGS_SIZE (const_int 12 [0xc]) (nil (insn 765 764 766 50 (set (mem:HI (pre_modify:SI (reg/f:SI 7 sp) (plus:SI (reg/f:SI 7 sp) (const_int -4 [0xfffc]))) [49 S2 A16]) (reg/v:HI 1 dx [orig:232 v ] [232])) ../../../../libgo/go/encoding/binary/binary.go:273 71 {*pushhi2} (expr_list:REG_DEAD (reg/v:HI 1 dx [orig:232 v ] [232]) (expr_list:REG_ARGS_SIZE (const_int 16 [0x10]) (nil until CSA pass where it gets transformed as: (insn 762 761 765 50 (set (mem/c:SI (plus:SI (reg/f:SI 7 sp) (const_int 112 [0x70])) [17 MEM[(struct *)bs + 8B]+0 S4 A64]) (const_int 8 [0x8])) ../../../../libgo/go/encoding/binary/binary.go:273 90 {*movsi_internal} (nil)) (insn 765 762 766 50 (set (mem:HI (reg/f:SI 7 sp) [49 S2 A16]) (reg/v:HI 1 dx [orig:232 v ] [232])) ../../../../libgo/go/encoding/binary/binary.go:273 91 {*movhi_internal} (expr_list:REG_DEAD (reg/v:HI 1 dx [orig:232 v ] [232]) (expr_list:REG_ARGS_SIZE (const_int 16 [0x10]) (nil My conclussion thus would be that CSA ought to remove the REG_ARGS_SIZE note since it combines stack adjustment with call insn much earlier in the insn stream: (insn 749 746 750 50 (set (mem/f:SI (pre_dec:SI (reg/f:SI 7 sp)) [6 S4 A32]) (mem/u/c:SI (plus:SI (reg:SI 3 bx) (const:SI (unspec:SI [ (symbol_ref/i:SI (__go_tdn_uint16) var_decl 0x76f23850 __go_tdn_uint16) ] UNSPEC_GOT))) [58 S4 A8])) ../../../../libgo/go/encoding/binary/binary.go:271 66 {*pushsi2} (expr_list:REG_ARGS_SIZE (const_int
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 --- Comment #5 from Jan Hubicka hubicka at gcc dot gnu.org --- I am testing: Index: combine-stack-adj.c === --- combine-stack-adj.c (revision 206233) +++ combine-stack-adj.c (working copy) @@ -567,6 +568,7 @@ combine_stack_adjustments_for_block (bas try_apply_stack_adjustment (insn, reflist, 0, -last_sp_adjust)) { + rtx note; if (last2_sp_set) maybe_move_args_size_note (last2_sp_set, last_sp_set, false); else @@ -576,6 +578,11 @@ combine_stack_adjustments_for_block (bas reflist = NULL; last_sp_set = NULL_RTX; last_sp_adjust = 0; + /* We no longer adjust stack size. Whoever adjusted it earlier +hopefully got the note right. */ + note = find_reg_note (insn, REG_ARGS_SIZE, NULL_RTX); + if (note) + remove_note (insn, note); continue; } }
[Bug debug/59575] [4.9 regression] ICE in maybe_record_trace_start, at dwarf2cfi.c:2239
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59575 Jan Hubicka hubicka at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2013-12-27 CC||hubicka at gcc dot gnu.org Summary|ICE in |[4.9 regression] ICE in |maybe_record_trace_start, |maybe_record_trace_start, |at dwarf2cfi.c:2239 |at dwarf2cfi.c:2239 Ever confirmed|0 |1 --- Comment #1 from Jan Hubicka hubicka at gcc dot gnu.org --- Same ICE also breaks bootstrap with -mno-accumulate-outoging-args on 32bit /home/jh/trunk/build4/./gcc/gccgo -B/home/jh/trunk/build4/./gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include -minline-all-stringops -O2 -mno-accumulate-outgoing-args -g -m32 -I . -c -fgo-pkgpath=encoding/binary ../../../../libgo/go/encoding/binary/binary.go ../../../../libgo/go/encoding/binary/varint.go -fPIC -o encoding/.libs/binary.o ./libtool: line 1143: warning: setlocale: LC_CTYPE: cannot change locale (cs_CZ.ISO-8859-2) ../../../../libgo/go/encoding/binary/binary.go: In function 'binary.Write': ../../../../libgo/go/encoding/binary/binary.go:334:1: internal compiler error: in maybe_record_trace_start, at dwarf2cfi.c:2239 } ^ Please submit a full bug report, with preprocessed source if appropriate. See http://gcc.gnu.org/bugs.html for instructions.