aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-02-13 11:37:35 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2012-02-13 11:37:35 +0100
commit205ec405fc77c42a21ba12927a23985bf7176e58 (patch)
treeed8769515c0c91e62b83378f6bd7d0b723a42c68 /gcc/expr.c
parent5ac5049603ea4650a07166ee09a6b3c2ae0a01d8 (diff)
downloadgcc-205ec405fc77c42a21ba12927a23985bf7176e58.zip
gcc-205ec405fc77c42a21ba12927a23985bf7176e58.tar.gz
gcc-205ec405fc77c42a21ba12927a23985bf7176e58.tar.bz2
re PR middle-end/52209 (wrong code at -O0)
PR middle-end/52209 * expr.c (expand_expr_real_2) <case BIT_NOT_EXPR>: Only expand using XOR for reduce_bit_field if type is unsigned. * gcc.c-torture/execute/pr52209.c: New test. From-SVN: r184151
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index e63ed3b..2e716cc 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -8600,8 +8600,9 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
if (modifier == EXPAND_STACK_PARM)
target = 0;
/* In case we have to reduce the result to bitfield precision
- expand this as XOR with a proper constant instead. */
- if (reduce_bit_field)
+ for unsigned bitfield expand this as XOR with a proper constant
+ instead. */
+ if (reduce_bit_field && TYPE_UNSIGNED (type))
temp = expand_binop (mode, xor_optab, op0,
immed_double_int_const
(double_int_mask (TYPE_PRECISION (type)), mode),