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
This commit is contained in:
Jeff Law 2014-03-28 16:02:32 -06:00 committed by Jeff Law
parent 5294e4c32d
commit e7f3178934
5 changed files with 96 additions and 7 deletions

View 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

View 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

View 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);

View 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

View File

@ -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);
}