Bug 24908 - [4.0/4.1/4.2 Regression] ICE in dwarf2out for cpu2000 with -funroll-loops -fno-tree-copyrename
Summary: [4.0/4.1/4.2 Regression] ICE in dwarf2out for cpu2000 with -funroll-loops -fn...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: 4.0.3
Assignee: Alan Modra
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-on-valid-code, patch
Depends on:
Blocks:
 
Reported: 2005-11-16 22:08 UTC by Janis Johnson
Modified: 2005-12-08 23:51 UTC (History)
4 users (show)

See Also:
Host:
Target: powerpc-linux
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-11-18 13:20:12


Attachments
minimized testcase (166 bytes, text/plain)
2005-11-16 22:09 UTC, Janis Johnson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Janis Johnson 2005-11-16 22:08:01 UTC
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.
Comment 1 Janis Johnson 2005-11-16 22:09:17 UTC
Created attachment 10261 [details]
minimized testcase
Comment 2 Alan Modra 2005-11-16 23:04:00 UTC
.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.
Comment 3 Andrew Pinski 2005-11-16 23:10:37 UTC
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.
Comment 4 Andrew Pinski 2005-11-16 23:18:27 UTC
The current code for the ICE came in with PR 15813 but it seems like it should have ICE before that.
Comment 5 Andrew Pinski 2005-11-16 23:22:30 UTC
(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.
Comment 6 Andrew Pinski 2005-11-16 23:25:05 UTC
This is a regression from 3.4.0 which would not ICE on this at all, though would provide wrong-debug/wrong undwind info.
Comment 7 Mark Mitchell 2005-11-19 02:19:05 UTC
Showstopper.
Comment 8 Alan Modra 2005-12-08 23:43:43 UTC
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

Comment 9 Alan Modra 2005-12-08 23:47:51 UTC
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

Comment 10 Alan Modra 2005-12-08 23:50:44 UTC
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

Comment 11 Alan Modra 2005-12-08 23:51:17 UTC
Fixed.