aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorRichard Earnshaw <rearnsha@arm.com>2020-11-24 16:21:17 +0000
committerRichard Earnshaw <rearnsha@arm.com>2020-11-24 16:35:11 +0000
commitf30a9a8d9e06ae2bf38e0d25e3ca6095212c78e9 (patch)
tree769e77479c0bf8e207a94679f520cbb09d520670 /gcc/c
parent13f93cf5336ec0085277b9a5ef88c02359527170 (diff)
downloadgcc-f30a9a8d9e06ae2bf38e0d25e3ca6095212c78e9.zip
gcc-f30a9a8d9e06ae2bf38e0d25e3ca6095212c78e9.tar.gz
gcc-f30a9a8d9e06ae2bf38e0d25e3ca6095212c78e9.tar.bz2
arm: correctly handle negating INT_MIN in arm_split_atomic_op [PR97534]
arm_split_atomic_op handles subtracting a constant by converting it into addition of the negated constant. But if the type of the operand is int and the constant is -1 we currently end up generating invalid RTL which can lead to an abort later on. The problem is that in a HOST_WIDE_INT, INT_MIN is represented as 0xffffffff80000000 and the negation of this is 0x0000000080000000, but that's not a valid constant for use in SImode operations. The fix is straight-forward which is to use gen_int_mode rather than simply GEN_INT. This knows how to correctly sign-extend the negated constant when this is needed. gcc/ PR target/97534 * config/arm/arm.c (arm_split_atomic_op): Use gen_int_mode when negating a const_int. gcc/testsuite * gcc.dg/pr97534.c: New test.
Diffstat (limited to 'gcc/c')
0 files changed, 0 insertions, 0 deletions