]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR rtl-optimization/44691 (ICE: RTL check: expected code 'reg', have...
authorAlexander Monakov <amonakov@ispras.ru>
Fri, 12 Nov 2010 15:47:38 +0000 (18:47 +0300)
committerAlexander Monakov <amonakov@gcc.gnu.org>
Fri, 12 Nov 2010 15:47:38 +0000 (18:47 +0300)
Backport from mainline:
2010-08-19  Andrey Belevantsev  <abel@ispras.ru>

PR rtl-optimization/44691
* sel-sched.c (count_occurrences_1): Also punt when SUBREG_REG
is not a register.

* gfortran.dg/pr44691.f: New test.

From-SVN: r166653

gcc/ChangeLog
gcc/sel-sched.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr44691.f [new file with mode: 0644]

index 5394bbd8f0a3ffb574a61cb4aeb1a840ccef5cb7..a15f5d1fd2ff473582530b1abd40dd847decca3e 100644 (file)
@@ -1,3 +1,12 @@
+2010-11-12  Alexander Monakov  <amonakov@ispras.ru>
+
+       Backport from mainline:
+       2010-08-19  Andrey Belevantsev  <abel@ispras.ru>
+
+       PR rtl-optimization/44691
+       * sel-sched.c (count_occurrences_1): Also punt when SUBREG_REG
+       is not a register.
+
 2010-11-12  Richard Guenther  <rguenther@suse.de>
 
        Backport from mainline
index 09cb897173086e08a644ed3f56a31fa3a9a071fe..cb2bfeb817386d3e7ea3c1c73a3ea23240782719 100644 (file)
@@ -836,7 +836,8 @@ count_occurrences_1 (rtx *cur_rtx, void *arg)
 
   if (GET_CODE (*cur_rtx) == SUBREG
       && REG_P (p->x)
-      && REGNO (SUBREG_REG (*cur_rtx)) == REGNO (p->x))
+      && (!REG_P (SUBREG_REG (*cur_rtx))
+         || REGNO (SUBREG_REG (*cur_rtx)) == REGNO (p->x)))
     {
       /* ??? Do not support substituting regs inside subregs.  In that case,
          simplify_subreg will be called by validate_replace_rtx, and
index d87711af61f4e96d3b44ca8ff7cf7649d870154c..3086e197cd75386dc1c07c64b007e18c9ce0ef48 100644 (file)
@@ -1,3 +1,11 @@
+2010-11-12  Alexander Monakov  <amonakov@ispras.ru>
+
+       Backport from mainline:
+       2010-08-19  Andrey Belevantsev  <abel@ispras.ru>
+
+       PR rtl-optimization/44691
+       * gfortran.dg/pr44691.f: New test.
+
 2010-11-12  Richard Guenther  <rguenther@suse.de>
 
        Backport from mainline
diff --git a/gcc/testsuite/gfortran.dg/pr44691.f b/gcc/testsuite/gfortran.dg/pr44691.f
new file mode 100644 (file)
index 0000000..dc57c44
--- /dev/null
@@ -0,0 +1,41 @@
+C PR rtl-optimization/44691
+C { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } }
+C { dg-options "-O2 -fselective-scheduling2" }
+
+      SUBROUTINE ORIEN(IW,NATOT,NTOTORB,NATORB,P,T)
+      IMPLICIT DOUBLE PRECISION(A-H,O-Z)
+      DIMENSION NATORB(NATOT),P(NTOTORB*(NTOTORB+1)/2)
+      DIMENSION T(NTOTORB,NTOTORB)
+      DO 9000 IATOM=1,NATOT
+         ILAST = NTOTORB
+         IF (IATOM.NE.NATOT) ILAST=NATORB(IATOM+1)-1
+         DO 8000 IAOI=NATORB(IATOM),ILAST
+            DO 7000 IAOJ = IAOI+1,ILAST
+               R2 = 0.0D+00
+               R3 = 0.0D+00
+               DO 6000 INOTA=1,NATOT
+                  DO 5000 IK=NATORB(INOTA),NTOTORB
+                     IMAI=MAX(IK,IAOI)
+                     IMII=MIN(IK,IAOI)
+                     IMAJ=MAX(IK,IAOJ)
+                     IMIJ=MIN(IK,IAOJ)
+                     IKI=(IMAI*(IMAI-1))/2 + IMII
+                     IKJ=(IMAJ*(IMAJ-1))/2 + IMIJ
+                     PIKI=P(IKI)
+                     PIKJ=P(IKJ)
+                     R2 = R2 + (PIKI**4)-6*(PIKI*PIKI*PIKJ*PIKJ)+(PIKJ)
+ 5000             CONTINUE
+ 6000          CONTINUE
+               R2 = (R2/4.0D+00)
+               Q = SQRT(R2*R2 + R3*R3)
+               IF (Q.LT.1.0D-08) GO TO 7000
+               A = COS(THETA)
+               B = -SIN(THETA)
+               CALL ROT1INT(NTOTORB,IAOI,IAOJ,A,B,P)
+ 7000       CONTINUE
+ 8000    CONTINUE
+ 9000 CONTINUE
+      RETURN
+      END
+
+