aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorAndrew Pinski <andrew_pinski@playstation.sony.com>2007-04-23 01:53:56 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2007-04-22 18:53:56 -0700
commit1f2ad84c3c4c7975b49b09ae9fc1a6b62be19e13 (patch)
tree4513c5254a2c57ebf8614052ec61b449af5ec70e /gcc/expr.c
parent51da21be95f20ad512253b0420ea743506dd2f0f (diff)
downloadgcc-1f2ad84c3c4c7975b49b09ae9fc1a6b62be19e13.zip
gcc-1f2ad84c3c4c7975b49b09ae9fc1a6b62be19e13.tar.gz
gcc-1f2ad84c3c4c7975b49b09ae9fc1a6b62be19e13.tar.bz2
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
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index c644933..e239f4c6 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -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)