aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2014-03-28 16:02:32 -0600
committerJeff Law <law@gcc.gnu.org>2014-03-28 16:02:32 -0600
commite7f317893469434eeb833e29fa888ee33a488f3e (patch)
tree3c054d8b3672d6ff1f01c490ff6c443f86c08e5c /gcc
parent5294e4c32d617f2a52e47fb08d9b83b83885f469 (diff)
downloadgcc-e7f317893469434eeb833e29fa888ee33a488f3e.zip
gcc-e7f317893469434eeb833e29fa888ee33a488f3e.tar.gz
gcc-e7f317893469434eeb833e29fa888ee33a488f3e.tar.bz2
re PR target/60648 (ICE (segmentation fault) in expand_binop)
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/i386/i386.c4
-rw-r--r--gcc/expr.c11
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/pr60648.C73
5 files changed, 96 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a4108ad..f3899b7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 328fe40..3eefe4a 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -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
diff --git a/gcc/expr.c b/gcc/expr.c
index cdb4551..ebf136e 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -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);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5d9b433..7601833 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..80c0561
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr60648.C
@@ -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);
+}
+
+
+