diff options
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/expr.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr32244-1.c | 20 |
4 files changed, 35 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f16c87a..824f85a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-01-25 Richard Guenther <rguenther@suse.de> + + PR middle-end/32244 + * expr.c (expand_expr_real_1): Reduce result of LSHIFT_EXPR + to its bitfield precision if required. + 2008-01-25 Jakub Jelinek <jakub@redhat.com> PR middle-end/33880 @@ -8920,8 +8920,11 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, target = 0; op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, EXPAND_NORMAL); - return expand_shift (code, mode, op0, TREE_OPERAND (exp, 1), target, + temp = expand_shift (code, mode, op0, TREE_OPERAND (exp, 1), target, unsignedp); + if (code == LSHIFT_EXPR) + temp = REDUCE_BIT_FIELD (temp); + return temp; /* Could determine the answer when only additive constants differ. Also, the addition of one can be handled by changing the condition. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 407d42d..9fbd03a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2008-01-25 Richard Guenther <rguenther@suse.de> + PR middle-end/32244 + * gcc.c-torture/execute/pr32244-1.c: New testcase. + +2008-01-25 Richard Guenther <rguenther@suse.de> + PR tree-optimization/34966 * gcc.c-torture/compile/pr34966.c: New testcase. diff --git a/gcc/testsuite/gcc.c-torture/execute/pr32244-1.c b/gcc/testsuite/gcc.c-torture/execute/pr32244-1.c new file mode 100644 index 0000000..afad256 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr32244-1.c @@ -0,0 +1,20 @@ +struct foo +{ + unsigned long long b:40; +} x; + +extern void abort (void); + +void test1(unsigned long long res) +{ + /* The shift is carried out in 40 bit precision. */ + if (x.b<<32 != res) + abort (); +} + +int main() +{ + x.b = 0x0100; + test1(0); + return 0; +} |