diff options
author | Richard Guenther <rguenther@suse.de> | 2011-07-18 13:39:28 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-07-18 13:39:28 +0000 |
commit | e002c7cbaff40445b05da1d5213cb8a08422fb9e (patch) | |
tree | 4a67ef0edc4087bb16956e1e1b5c1419eaff28d5 /gcc/expr.c | |
parent | c1f5148401fd1afdc30a3b6d34257186376b98a6 (diff) | |
download | gcc-e002c7cbaff40445b05da1d5213cb8a08422fb9e.zip gcc-e002c7cbaff40445b05da1d5213cb8a08422fb9e.tar.gz gcc-e002c7cbaff40445b05da1d5213cb8a08422fb9e.tar.bz2 |
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
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -8037,7 +8037,15 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode, 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; |