+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>
* config.gcc (i[3456x]86-*-netware*): Remove.
VOIDmode, EXPAND_NORMAL);
if (modifier == EXPAND_STACK_PARM)
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);
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>
* g++.dg/ext/bitfield2.C: Remove i?86-*-netware support.
--- /dev/null
+/* { 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;
+}