@@ -1,3 +1,12 @@
+2014-03-27 Jeff Law <law@redhat.com>
+ Jakub Jalinek <jakub@redhat.com>
+
+ * 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-26 Richard Biener <rguenther@suse.de>
* tree-pretty-print.c (percent_K_format): Implement special
@@ -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
@@ -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);
@@ -1,3 +1,8 @@
+2014-03-27 Jeff Law <law@redhat.com>
+
+ PR target/60648
+ * g++.dg/pr60648.C: New test.
+
2014-03-26 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/60636
new file mode 100644
@@ -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);
+}
+
+
+