re PR middle-end/31448 (ICE in expand_shift with bit fields and expand inlining constants)

2007-04-22  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR middle-end/31448
        * expr.c (reduce_to_bit_field_precision): Handle
        CONST_INT rtx's.

2007-04-22  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR middle-end/31448
        * gcc.c-torture/execute/pr31448.c: New testcase.

From-SVN: r124054
This commit is contained in:
Andrew Pinski 2007-04-23 01:53:56 +00:00 committed by Andrew Pinski
parent 51da21be95
commit 1f2ad84c3c
4 changed files with 55 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2007-04-22 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR middle-end/31448
* expr.c (reduce_to_bit_field_precision): Handle
CONST_INT rtx's.
2007-04-22 Uros Bizjak <ubizjak@gmail.com>
PR tree-optimization/24659

View File

@ -8962,7 +8962,14 @@ reduce_to_bit_field_precision (rtx exp, rtx target, tree type)
HOST_WIDE_INT prec = TYPE_PRECISION (type);
if (target && GET_MODE (target) != GET_MODE (exp))
target = 0;
if (TYPE_UNSIGNED (type))
/* For constant values, reduce using build_int_cst_type. */
if (GET_CODE (exp) == CONST_INT)
{
HOST_WIDE_INT value = INTVAL (exp);
tree t = build_int_cst_type (type, value);
return expand_expr (t, target, VOIDmode, EXPAND_NORMAL);
}
else if (TYPE_UNSIGNED (type))
{
rtx mask;
if (prec < HOST_BITS_PER_WIDE_INT)

View File

@ -1,3 +1,8 @@
2007-04-22 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR middle-end/31448
* gcc.c-torture/execute/pr31448.c: New testcase.
2007-04-22 Nick Clifton <nickc@redhat.com>
* gcc.dg/20020312-2.c: Add support for the FRV.

View File

@ -0,0 +1,36 @@
/* PR middle-end/31448, this used to ICE during expand because
reduce_to_bit_field_precision was not ready to handle constants. */
typedef struct _st {
int iIndex : 24;
int iIndex1 : 24;
} st;
st *next;
void g(void)
{
st *next = 0;
int nIndx;
const static int constreg[] = { 0,};
nIndx = 0;
next->iIndex = constreg[nIndx];
}
void f(void)
{
int nIndx;
const static int constreg[] = { 0xFEFEFEFE,};
nIndx = 0;
next->iIndex = constreg[nIndx];
next->iIndex1 = constreg[nIndx];
}
int main(void)
{
st a;
next = &a;
f();
if (next->iIndex != 0xFFFEFEFE)
__builtin_abort ();
if (next->iIndex1 != 0xFFFEFEFE)
__builtin_abort ();
return 0;
}