]> git.ipfire.org Git - thirdparty/gcc.git/commit
untyped calls: enable target switching [PR112334]
authorAlexandre Oliva <oliva@adacore.com>
Tue, 12 Dec 2023 04:12:04 +0000 (01:12 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Tue, 12 Dec 2023 04:12:04 +0000 (01:12 -0300)
commitd96533559e26dd0c86f0708fa46eef65c35f7b90
tree4d7b816ddbbc18c702c90a73e85655ef6948ecee
parent07dcb39e08aa52f166e8d74420364757002ad756
untyped calls: enable target switching [PR112334]

The computation of apply_args_size and apply_result_size is saved in a
static variable, so that the corresponding _mode arrays are
initialized only once.  That is not compatible with switchable
targets, and ARM's arm_set_current_function, by saving and restoring
target globals, exercises this problem with a testcase such as that in
the PR, in which more than one function in the translation unit calls
__builtin_apply or __builtin_return, respectively.

This patch moves the _size statics into the target_builtins array,
with a bit of ugliness over _plus_one so that zero initialization of
the struct does the right thing.

for  gcc/ChangeLog

PR target/112334
* builtins.h (target_builtins): Add fields for apply_args_size
and apply_result_size.
* builtins.cc (apply_args_size, apply_result_size): Cache
results in fields rather than in static variables.
(get_apply_args_size, set_apply_args_size): New.
(get_apply_result_size, set_apply_result_size): New.
gcc/builtins.cc
gcc/builtins.h