aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-02-27 09:50:04 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-02-27 09:50:04 +0000
commit70582b3afe47248d2b70c5731fb7cf44fa17dc16 (patch)
treeef16ed7af638323b496055d922dbdc8e19ef42aa /gcc/expr.c
parenta15f0fd02870fef9742d517d0894e02bdd0bbdb3 (diff)
downloadgcc-70582b3afe47248d2b70c5731fb7cf44fa17dc16.zip
gcc-70582b3afe47248d2b70c5731fb7cf44fa17dc16.tar.gz
gcc-70582b3afe47248d2b70c5731fb7cf44fa17dc16.tar.bz2
re PR middle-end/34971 (bitfield rotates are folded and expanded wrong)
2008-02-27 Richard Guenther <rguenther@suse.de> PR middle-end/34971 * expr.c (expand_expr_real_1): Assert on rotates that operate on partial modes. * fold-const.c (fold_binary): Use the types precision, not the bitsize of the mode if folding rotate expressions. Build rotates only for full modes. * gcc.c-torture/execute/pr34971.c: New testcase. From-SVN: r132706
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 3674191..79a039a 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -8898,10 +8898,16 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
case BIT_XOR_EXPR:
goto binop;
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
case LROTATE_EXPR:
case RROTATE_EXPR:
+ /* The expansion code only handles expansion of mode precision
+ rotates. */
+ gcc_assert (GET_MODE_PRECISION (TYPE_MODE (type))
+ == TYPE_PRECISION (type));
+
+ /* Falltrough. */
+ case LSHIFT_EXPR:
+ case RSHIFT_EXPR:
/* If this is a fixed-point operation, then we cannot use the code
below because "expand_shift" doesn't support sat/no-sat fixed-point
shifts. */