aboutsummaryrefslogtreecommitdiff
path: root/arm64
diff options
context:
space:
mode:
authorAlexey Yerin <[email protected]>2024-08-02 14:39:07 +0300
committerQuentin Carbonneaux <[email protected]>2024-08-15 23:21:05 +0200
commitbb8de8c63362b7234db02482240d5600203225d9 (patch)
tree5e5e9e6bca2ad8f4990efe2ae07986172438a5cc /arm64
parentefcb5465e597571820391bee450dd1e8def300b4 (diff)
arm64/isel: Avoid signed overflow when handling immediates
Clang incorrectly optimizes this negation with -O2 and causes QBE to emit 0 in place of INT64_MIN.
Diffstat (limited to 'arm64')
-rw-r--r--arm64/isel.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arm64/isel.c b/arm64/isel.c
index 062beb3..9ce6adc 100644
--- a/arm64/isel.c
+++ b/arm64/isel.c
@@ -24,7 +24,7 @@ imm(Con *c, int k, int64_t *pn)
i = Iplo12;
if (n < 0) {
i = Inlo12;
- n = -n;
+ n = -(uint64_t)n;
}
*pn = n;
if ((n & 0x000fff) == n)