]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR middle-end/77377 (c-c++-common/pr59037.c ICEs with -fpic -msse on...
authorJakub Jelinek <jakub@redhat.com>
Tue, 30 May 2017 07:17:45 +0000 (09:17 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 30 May 2017 07:17:45 +0000 (09:17 +0200)
Backported from mainline
2016-08-30  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/77377
* simplify-rtx.c (avoid_constant_pool_reference): For out of bounds
constant pool reference return x instead of c.

* gcc.target/i386/pr77377.c: New test.

From-SVN: r248601

gcc/ChangeLog
gcc/simplify-rtx.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr77377.c [new file with mode: 0644]

index 42f03d60e4e59c9ba823fb5a381d4786fc88a7e2..d01b2705e7ed254853b6d71e5e7d5e1aa09a19de 100644 (file)
@@ -1,6 +1,12 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-08-30  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/77377
+       * simplify-rtx.c (avoid_constant_pool_reference): For out of bounds
+       constant pool reference return x instead of c.
+
        2016-08-16  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/71910
index c85ae3e1928b1bd9ffa362352ffae17222700313..2982bd21a1ed6163eb47d491bbb3b54b5b9f7a33 100644 (file)
@@ -283,15 +283,14 @@ avoid_constant_pool_reference (rtx x)
       /* If we're accessing the constant in a different mode than it was
          originally stored, attempt to fix that up via subreg simplifications.
          If that fails we have no choice but to return the original memory.  */
-      if ((offset != 0 || cmode != GET_MODE (x))
-         && offset >= 0 && offset < GET_MODE_SIZE (cmode))
+      if (offset == 0 && cmode == GET_MODE (x))
+       return c;
+      else if (offset >= 0 && offset < GET_MODE_SIZE (cmode))
         {
           rtx tem = simplify_subreg (GET_MODE (x), c, cmode, offset);
           if (tem && CONSTANT_P (tem))
             return tem;
         }
-      else
-        return c;
     }
 
   return x;
index 213ce7f0280dede96a4a5270cbbd373756236ef5..5b189f210b1f7fe871e8854c6769cc351ab657e0 100644 (file)
@@ -1,6 +1,11 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-08-30  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/77377
+       * gcc.target/i386/pr77377.c: New test.
+
        2016-08-16  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/71910
diff --git a/gcc/testsuite/gcc.target/i386/pr77377.c b/gcc/testsuite/gcc.target/i386/pr77377.c
new file mode 100644 (file)
index 0000000..4f7eaa4
--- /dev/null
@@ -0,0 +1,6 @@
+/* PR middle-end/77377 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -msse" } */
+/* { dg-additional-options "-fpic" { target fpic } } */
+
+#include "../../c-c++-common/pr59037.c"