Commit e002c7cb by Richard Guenther Committed by Richard Biener

expr.c (expand_expr_real_2): Properly truncate the BIT_NOT_EXPR expansion result…

expr.c (expand_expr_real_2): Properly truncate the BIT_NOT_EXPR expansion result to bitfield precision if...

2011-07-18  Richard Guenther  <rguenther@suse.de>

	* expr.c (expand_expr_real_2): Properly truncate the BIT_NOT_EXPR
	expansion result to bitfield precision if required.

	* gcc.dg/torture/20110718-1.c: New testcase.

From-SVN: r176398
parent c1f51484
2011-07-18 Richard Guenther <rguenther@suse.de>
* expr.c (expand_expr_real_2): Properly truncate the BIT_NOT_EXPR
expansion result to bitfield precision if required.
2011-07-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2011-07-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* config.gcc (i[3456x]86-*-netware*): Remove. * config.gcc (i[3456x]86-*-netware*): Remove.
......
...@@ -8037,7 +8037,15 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode, ...@@ -8037,7 +8037,15 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
VOIDmode, EXPAND_NORMAL); VOIDmode, EXPAND_NORMAL);
if (modifier == EXPAND_STACK_PARM) if (modifier == EXPAND_STACK_PARM)
target = 0; target = 0;
temp = expand_unop (mode, one_cmpl_optab, op0, target, 1); /* In case we have to reduce the result to bitfield precision
expand this as XOR with a proper constant instead. */
if (reduce_bit_field)
temp = expand_binop (mode, xor_optab, op0,
immed_double_int_const
(double_int_mask (TYPE_PRECISION (type)), mode),
target, 1, OPTAB_LIB_WIDEN);
else
temp = expand_unop (mode, one_cmpl_optab, op0, target, 1);
gcc_assert (temp); gcc_assert (temp);
return temp; return temp;
......
2011-07-18 Richard Guenther <rguenther@suse.de>
* gcc.dg/torture/20110718-1.c: New testcase.
2011-07-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2011-07-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* g++.dg/ext/bitfield2.C: Remove i?86-*-netware support. * g++.dg/ext/bitfield2.C: Remove i?86-*-netware support.
......
/* { dg-do run } */
extern void abort (void);
struct X {
#if (__SIZEOF_LONG__ != __SIZEOF_INT__) && (__SIZEOF_LONG__ == 8)
unsigned long i : 33;
#else
unsigned long i;
#endif
};
unsigned long __attribute__((noinline))
foo (struct X *p)
{
return ~p->i;
}
int main()
{
struct X x;
x.i = -1;
if (foo (&x) != 0)
abort ();
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