aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-parser.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-11-10 10:26:35 +0100
committerEric Botcazou <ebotcazou@adacore.com>2020-11-10 12:11:34 +0100
commit61dd8dab1f0b349fb4124cfd8e2a11a161f13e4a (patch)
tree1347f21e992fa9cb9a58d151204f5a0b5ed12968 /gcc/c/c-parser.c
parent15e5f41a1c88fce773cd9d13fe02052ace1803ce (diff)
downloadgcc-61dd8dab1f0b349fb4124cfd8e2a11a161f13e4a.zip
gcc-61dd8dab1f0b349fb4124cfd8e2a11a161f13e4a.tar.gz
gcc-61dd8dab1f0b349fb4124cfd8e2a11a161f13e4a.tar.bz2
Fix wrong code for boolean negation in condition at -O2
The problem is the bitwise/logical dichotomy for operators and the transition from the former to the latter for boolean types: if they are 1-bit, that's straightforward but, if they are larger, then you need to be careful because you cannot, on the one hand, turn a bitwise AND into a logical AND and, on the other hand, *not* turn e.g. a bitwise NOT into a logical NOT if they occur in the same computation, as the first change will drop the masking that may need to be applied after the bitwise NOT if it is not also changed. Given that the ranger turns bitwise AND/OR into logical AND/OR for booleans, the patch does the same for bitwise NOT. gcc/ChangeLog: * range-op.cc (operator_logical_not::fold_range): Tidy up. (operator_logical_not::op1_range): Call above method. (operator_bitwise_not::fold_range): If the type is compatible with boolean, call op_logical_not.fold_range. (operator_bitwise_not::op1_range): If the type is compatible with boolean, call op_logical_not.op1_range. gcc/testsuite/ChangeLog: * gnat.dg/opt88.adb: New test.
Diffstat (limited to 'gcc/c/c-parser.c')
0 files changed, 0 insertions, 0 deletions