aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.cc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2024-03-15 10:10:57 +0100
committerJakub Jelinek <jakub@redhat.com>2024-03-15 10:10:57 +0100
commit0319f265eddd17c32cb037b71489d9882a6eb00d (patch)
treeb0b0df8520e8d259dbff4369798c8b956fb1e4e9 /gcc/expr.cc
parent8ae7062bf4005c08b093828d40e2c9278e6f6d9c (diff)
downloadgcc-0319f265eddd17c32cb037b71489d9882a6eb00d.zip
gcc-0319f265eddd17c32cb037b71489d9882a6eb00d.tar.gz
gcc-0319f265eddd17c32cb037b71489d9882a6eb00d.tar.bz2
expand: EXTEND_BITINT CALL_EXPR results [PR114332]
The x86-64 and aarch64 psABIs (and the unwritten ia64 psABI part) say that the padding bits of _BitInt are undefined, while the expansion internally typically assumes that non-mode precision integers are sign/zero extended and extends after operations. We handle that mismatch with EXTEND_BITINT done when reading from untrusted sources like function arguments, reading _BitInt from memory etc. but otherwise keep relying on stuff being extended internally (say in pseudos). The return value of a function is an ABI boundary though too and we need to extend that too. 2024-03-15 Jakub Jelinek <jakub@redhat.com> PR middle-end/114332 * expr.cc (expand_expr_real_1): EXTEND_BITINT also CALL_EXPR results.
Diffstat (limited to 'gcc/expr.cc')
-rw-r--r--gcc/expr.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/expr.cc b/gcc/expr.cc
index f7d7452..2918c46 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -12350,7 +12350,8 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
return expand_builtin (exp, target, subtarget, tmode, ignore);
}
}
- return expand_call (exp, target, ignore);
+ temp = expand_call (exp, target, ignore);
+ return EXTEND_BITINT (temp);
case VIEW_CONVERT_EXPR:
op0 = NULL_RTX;