Bug 48967 - [4.6/4.7 Regression] ICE during use_narrower_mode
Summary: [4.6/4.7 Regression] ICE during use_narrower_mode
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.6.1
: P3 normal
Target Milestone: 4.6.1
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2011-05-11 17:48 UTC by Jakub Jelinek
Modified: 2011-05-12 13:53 UTC (History)
0 users

See Also:
Host:
Target: powerpc64-linux
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-05-11 17:57:44


Attachments
rh703888.ii (589 bytes, text/plain)
2011-05-11 17:48 UTC, Jakub Jelinek
Details
gcc46-pr48967.patch (1.00 KB, patch)
2011-05-11 17:56 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2011-05-11 17:48:36 UTC
Created attachment 24224 [details]
rh703888.ii

The attached testcase ICEs in 4.6 and 4.7 with -O2 -g -m64.
The problem is that lowpart_subreg returns NULL, as a SImode subreg of DImode register 32 (fp0) isn't allowed.

--- var-tracking.c.jj 2011-04-13 14:04:00.000000000 +0200
+++ var-tracking.c 2011-05-11 18:05:41.000000000 +0200
@@ -739,6 +739,10 @@ use_narrower_mode_test (rtx *loc, void *
     case REG:
       if (cselib_lookup (*loc, GET_MODE (SUBREG_REG (subreg)), 0, VOIDmode))
         return 1;
+      if (!validate_subreg (GET_MODE (subreg), GET_MODE (*loc),
+                            *loc, subreg_lowpart_offset (GET_MODE (subreg),
+                                                         GET_MODE (*loc))))
+        return 1;
       return -1;
     case PLUS:
     case MINUS:

seems to fix this and doesn't seem to ever trigger in x86_64-linux bootstrap (this optimization has been added mainly for x86_64).
Comment 1 Jakub Jelinek 2011-05-11 17:56:57 UTC
Created attachment 24225 [details]
gcc46-pr48967.patch

Fix.
Comment 2 Jakub Jelinek 2011-05-12 11:54:36 UTC
Author: jakub
Date: Thu May 12 11:54:33 2011
New Revision: 173701

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173701
Log:
	PR debug/48967
	* var-tracking.c (use_narrower_mode_test) <case REG>: Return 1
	if validate_subreg fails.

	* g++.dg/opt/pr48967.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/opt/pr48967.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/var-tracking.c
Comment 3 Jakub Jelinek 2011-05-12 11:59:34 UTC
Author: jakub
Date: Thu May 12 11:59:32 2011
New Revision: 173702

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173702
Log:
	PR debug/48967
	* var-tracking.c (use_narrower_mode_test) <case REG>: Return 1
	if validate_subreg fails.

	* g++.dg/opt/pr48967.C: New test.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/opt/pr48967.C
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_6-branch/gcc/var-tracking.c
Comment 4 Jakub Jelinek 2011-05-12 13:53:33 UTC
Fixed.