Bug 48237 - [4.6/4.7 Regression] ICE: in final_scan_insn, at final.c:2651 with -fselective-scheduling2 -mtune=core2
Summary: [4.6/4.7 Regression] ICE: in final_scan_insn, at final.c:2651 with -fselectiv...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.6.1
Assignee: Uroš Bizjak
URL: http://gcc.gnu.org/ml/gcc-patches/201...
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2011-03-22 13:38 UTC by Zdenek Sojka
Modified: 2011-03-26 18:42 UTC (History)
0 users

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build:
Known to work: 4.5.3
Known to fail: 4.6.0, 4.7.0
Last reconfirmed: 2011-03-22 16:27:54


Attachments
reduced testcase (144 bytes, text/plain)
2011-03-22 13:38 UTC, Zdenek Sojka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2011-03-22 13:38:32 UTC
Created attachment 23750 [details]
reduced testcase

Compiler output:
$ gcc -O -fcaller-saves -fschedule-insns2 -fselective-scheduling2 -mtune=core2 testcase.c
testcase.c: In function 'foo':
testcase.c:19:1: internal compiler error: in final_scan_insn, at final.c:2651
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

The failing assert is:
#ifdef HAVE_ATTR_length
	    /* This instruction should have been split in shorten_branches,
	       to ensure that we would have valid length info for the
	       splitees.  */
	    gcc_unreachable ();
#endif

Tested revisions:
r171265 - crash
4.6 r170955 - crash
4.5 r170955 - OK
Comment 1 Uroš Bizjak 2011-03-22 16:27:54 UTC
I have a patch:

Index: i386.md
===================================================================
--- i386.md	(revision 171294)
+++ i386.md	(working copy)
@@ -2938,7 +2938,7 @@
 
     case 3:
     case 4:
-      return "#";
+      return "mov{q}\t{%1, %0|%0, %1}";
 
     case 5:
       switch (get_attr_mode (insn))
@@ -3003,7 +3003,7 @@
       gcc_unreachable();
     }
 }
-  [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov,ssemov,ssemov")
+  [(set_attr "type" "fmov,fmov,fmov,imov,imov,sselog1,ssemov,ssemov,ssemov,ssemov,ssemov")
    (set (attr "prefix")
      (if_then_else (eq_attr "alternative" "0,1,2,3,4")
        (const_string "orig")
Comment 2 uros 2011-03-24 13:35:30 UTC
Author: uros
Date: Thu Mar 24 13:35:26 2011
New Revision: 171391

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171391
Log:
	PR target/48237
	* config/i386/i386.md (*movdf_internal_rex64): Do not split
	alternatives that can be handled with movq or movabsq insn.
	(*movdf_internal): Disable for !TARGET_64BIT.
	(*movdf_internal_nointeger): Ditto.
	* config/i386/i386.c (ix86_print_operand): Handle DFmode immediates.

testsuite/ChangeLog:

	PR target/48237
	* gcc.target/i386/pr48237.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/i386/pr48237.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/i386.md
    trunk/gcc/testsuite/ChangeLog
Comment 3 uros 2011-03-26 18:41:05 UTC
Author: uros
Date: Sat Mar 26 18:41:02 2011
New Revision: 171560

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171560
Log:
	Backport from mainline:
	2011-03-24  Uros Bizjak  <ubizjak@gmail.com>

	PR target/48237
	* config/i386/i386.md (*movdf_internal_rex64): Do not split
	alternatives that can be handled with movq or movabsq insn.
	(*movdf_internal): Disable for !TARGET_64BIT.
	(*movdf_internal_nointeger): Ditto.
	* config/i386/i386.c (ix86_print_operand): Handle DFmode immediates.

testsuite/ChangeLog:

	Backport from mainline:
	2011-03-24  Uros Bizjak  <ubizjak@gmail.com>

	PR target/48237
	* gcc.target/i386/pr48237.c: New test.


Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/i386/pr48237.c
Modified:
    branches/gcc-4_6-branch/gcc/config/i386/i386.c
    branches/gcc-4_6-branch/gcc/config/i386/i386.md
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 4 Uroš Bizjak 2011-03-26 18:42:39 UTC
Fixed.