Commit dd3b33d7 by Richard Guenther Committed by Richard Biener

re PR middle-end/32244 (bit-field: optimization BUG)

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.

	* gcc.c-torture/execute/pr32244-1.c: New testcase.

From-SVN: r131828
parent c256730c
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. */
......
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.
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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment