]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/60648 (ICE (segmentation fault) in expand_binop)
authorJeff Law <law@redhat.com>
Fri, 28 Mar 2014 22:02:32 +0000 (16:02 -0600)
committerJeff Law <law@gcc.gnu.org>
Fri, 28 Mar 2014 22:02:32 +0000 (16:02 -0600)
PR target/60648
       * expr.c (do_tablejump): Use simplify_gen_binary rather than
       gen_rtx_{PLUS,MULT} to build up the address expression.

       * i386/i386.c (ix86_legitimize_address): Use copy_addr_to_reg to avoid
       creating non-canonical RTL.

       PR target/60648
       * g++.dg/pr60648.C: New test.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r208924

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr60648.C [new file with mode: 0644]

index a4108ad12782de1bc52d7025d223a385563ae217..f3899b7cb114dfbae70845d2d80dddf8563d75ac 100644 (file)
@@ -1,3 +1,13 @@
+2014-03-27  Jeff Law  <law@redhat.com>
+           Jakub Jalinek <jakub@redhat.com>
+
+       PR target/60648
+       * expr.c (do_tablejump): Use simplify_gen_binary rather than
+       gen_rtx_{PLUS,MULT} to build up the address expression.
+
+       * i386/i386.c (ix86_legitimize_address): Use copy_addr_to_reg to avoid
+       creating non-canonical RTL.
+
 2014-03-28  Jan Hubicka  <hubicka@ucw.cz>
 
        PR ipa/60243
index 328fe409bacc11aff9ed9124cc901fbd1e5a45f0..3eefe4ac59838286a440ee2a8d052ee93b286175 100644 (file)
@@ -13925,13 +13925,13 @@ ix86_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
       if (GET_CODE (XEXP (x, 0)) == MULT)
        {
          changed = 1;
-         XEXP (x, 0) = force_operand (XEXP (x, 0), 0);
+         XEXP (x, 0) = copy_addr_to_reg (XEXP (x, 0));
        }
 
       if (GET_CODE (XEXP (x, 1)) == MULT)
        {
          changed = 1;
-         XEXP (x, 1) = force_operand (XEXP (x, 1), 0);
+         XEXP (x, 1) = copy_addr_to_reg (XEXP (x, 1));
        }
 
       if (changed
index cdb45518d2752ad16c80d0b207a94ff9fdd43ef1..ebf136ed5a30ff9e55b009586260e8f4f3a992e7 100644 (file)
@@ -11134,11 +11134,12 @@ do_tablejump (rtx index, enum machine_mode mode, rtx range, rtx table_label,
      GET_MODE_SIZE, because this indicates how large insns are.  The other
      uses should all be Pmode, because they are addresses.  This code
      could fail if addresses and insns are not the same size.  */
-  index = gen_rtx_PLUS
-    (Pmode,
-     gen_rtx_MULT (Pmode, index,
-                  gen_int_mode (GET_MODE_SIZE (CASE_VECTOR_MODE), Pmode)),
-     gen_rtx_LABEL_REF (Pmode, table_label));
+  index = simplify_gen_binary (MULT, Pmode, index,
+                              gen_int_mode (GET_MODE_SIZE (CASE_VECTOR_MODE),
+                                            Pmode));
+  index = simplify_gen_binary (PLUS, Pmode, index,
+                              gen_rtx_LABEL_REF (Pmode, table_label));
+
 #ifdef PIC_CASE_VECTOR_ADDRESS
   if (flag_pic)
     index = PIC_CASE_VECTOR_ADDRESS (index);
index 5d9b43358f707e8432469cb8cc9bbc146d0f46d8..7601833bd11712711b0e9cb29d6858bb83a3fbfb 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-27  Jeff Law  <law@redhat.com>
+
+       PR target/60648
+       * g++.dg/pr60648.C: New test.
+
 2014-03-28  Adam Butcher  <adam@jessamine.co.uk>
 
        PR c++/60573
diff --git a/gcc/testsuite/g++.dg/pr60648.C b/gcc/testsuite/g++.dg/pr60648.C
new file mode 100644 (file)
index 0000000..80c0561
--- /dev/null
@@ -0,0 +1,73 @@
+/* { dg-do compile } */
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O3 -fPIC -m32" }  */
+
+enum component
+{
+  Ex,
+  Ez,
+  Hy,
+  Permeability
+};
+enum derived_component
+{};
+enum direction
+{
+  X,
+  Y,
+  Z,
+  R,
+  P,
+  NO_DIRECTION
+};
+derived_component a;
+component *b;
+component c;
+direction d;
+inline direction fn1 (component p1)
+{
+  switch (p1)
+    {
+    case 0:
+      return Y;
+    case 1:
+      return Z;
+    case Permeability:
+      return NO_DIRECTION;
+    }
+  return X;
+}
+
+inline component fn2 (direction p1)
+{
+  switch (p1)
+    {
+    case 0:
+    case 1:
+      return component ();
+    case Z:
+    case R:
+      return component (1);
+    case P:
+      return component (3);
+    }
+}
+
+void fn3 ()
+{
+  direction e;
+  switch (0)
+  case 0:
+  switch (a)
+    {
+    case 0:
+      c = Ex;
+      b[1] = Hy;
+    }
+  e = fn1 (b[1]);
+  b[1] = fn2 (e);
+  d = fn1 (c);
+}
+
+
+