Eight SPEC CPU2000 tests fail with an ICE in dwarf2out_frame_debug_expr, at dwarf2out.c:1554, on powerpc-linux with the options "-g -fpic -O2 -funroll-loops -fno-tree-copyrename". The minimized testcase also fails with GCC 4.0.0 with those options plus "-fweb -frename-registers" which are now turned on with -funroll-loops. Some of the those CPU2000 tests pass with those options with GCC 4.0.0, but the bug is likely latent in those cases. I built SPEC CPU2000 with several sets of options generated by the tool allpairs, which takes sets of choices and combines them to have each pair of possibilities included in at least one set. It's likely that no sane user would come up with the set of options that cause this failure.
Created attachment 10261 [details] minimized testcase
.ce3 (insn/f 81 80 82 0 /src/tmp/24908.c:11 (set (reg:SI 12 12) (reg:SI 65 lr)) -1 (nil) (expr_list:REG_DEAD (reg:SI 65 lr) (expr_list:REG_MAYBE_DEAD (const_int 0 [0x0]) (nil)))) (insn 82 81 83 0 /src/tmp/24908.c:11 (set (reg:SI 65 lr) (unspec:SI [ (const_int 0 [0x0]) ] 7)) -1 (nil) (expr_list:REG_MAYBE_DEAD (const_int 0 [0x0]) (nil))) ====== .rnreg (insn/f 81 80 82 0 /src/tmp/24908.c:11 (set (reg:SI 26 26) (reg:SI 65 lr)) 282 {*movsi_internal1} (nil) (expr_list:REG_DEAD (reg:SI 65 lr) (expr_list:REG_MAYBE_DEAD (const_int 0 [0x0]) (nil)))) (insn 82 81 83 0 /src/tmp/24908.c:11 (set (reg:SI 65 lr) (unspec:SI [ (const_int 0 [0x0]) ] 7)) 372 {load_toc_v4_pic_si} (nil) (expr_list:REG_MAYBE_DEAD (const_int 0 [0x0]) (nil))) I think the assert in dwarf2out.c is wrong, that's all. rnreg is doing something perfectly ok, even if possibly unnecessary, and dwarf2out gets its knickers in a knot.
This is the assert by the way: /* Saving a register in a register. */ gcc_assert (call_used_regs [REGNO (dest)] && (!fixed_regs [REGNO (dest)] /* For the SPARC and its register window. */ || DWARF_FRAME_REGNUM (REGNO (src)) == DWARF_FRAME_RETURN_COLUMN)); saving the register in r26 is valid as there are no calls in this function at all.
The current code for the ICE came in with PR 15813 but it seems like it should have ICE before that.
(In reply to comment #4) > The current code for the ICE came in with PR 15813 but it seems like it should have ICE before that. Or provided the wrong undwind info really.
This is a regression from 3.4.0 which would not ICE on this at all, though would provide wrong-debug/wrong undwind info.
Showstopper.
Subject: Bug 24908 Author: amodra Date: Thu Dec 8 23:43:40 2005 New Revision: 108257 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108257 Log: PR debug/24908 * dwarf2out.c (dwarf2out_frame_debug_expr): Don't assert that call_used_regs can't be used to save reg in another reg. Modified: trunk/gcc/ChangeLog trunk/gcc/dwarf2out.c
Subject: Bug 24908 Author: amodra Date: Thu Dec 8 23:47:48 2005 New Revision: 108258 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108258 Log: PR debug/24908 * dwarf2out.c (dwarf2out_frame_debug_expr): Don't assert that call_used_regs can't be used to save reg in another reg. Modified: branches/gcc-4_1-branch/gcc/ChangeLog branches/gcc-4_1-branch/gcc/dwarf2out.c
Subject: Bug 24908 Author: amodra Date: Thu Dec 8 23:50:40 2005 New Revision: 108259 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108259 Log: PR debug/24908 * dwarf2out.c (dwarf2out_frame_debug_expr): Don't assert that call_used_regs can't be used to save reg in another reg. Modified: branches/gcc-4_0-branch/gcc/ChangeLog branches/gcc-4_0-branch/gcc/dwarf2out.c
Fixed.