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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124054
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
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)
+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.
--- /dev/null
+/* 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;
+}
+