aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-08-23 09:44:06 +0200
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-09-03 10:16:52 +0200
commit9362abf5e81eb2e6e35f55f36ff8e7a31aef4e9d (patch)
treed0d5a7cbf36e9f2592f0e97fc903040ef1bb6be0
parent0a862c5af5c603baab8715bbcca6890f77cc59e2 (diff)
downloadgcc-9362abf5e81eb2e6e35f55f36ff8e7a31aef4e9d.zip
gcc-9362abf5e81eb2e6e35f55f36ff8e7a31aef4e9d.tar.gz
gcc-9362abf5e81eb2e6e35f55f36ff8e7a31aef4e9d.tar.bz2
ada: Plug loophole exposed by previous change
The change causes more temporaries to be created at call sites for unaligned actual parameters, thus revealing that the machinery does not properly deal with unconstrained nominal subtypes for them. gcc/ada/ * gcc-interface/trans.cc (create_temporary): Deal with types whose size is self-referential by allocating the maximum size.
-rw-r--r--gcc/ada/gcc-interface/trans.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc
index caa0f56..fadd6b4 100644
--- a/gcc/ada/gcc-interface/trans.cc
+++ b/gcc/ada/gcc-interface/trans.cc
@@ -4527,6 +4527,9 @@ storage_model_access_required_p (Node_Id gnat_node, Entity_Id *gnat_smo)
static tree
create_temporary (const char *prefix, tree type)
{
+ if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE (type)))
+ type = maybe_pad_type (type, max_size (TYPE_SIZE (type), true), 0,
+ Empty, false, false, true);
tree gnu_temp
= create_var_decl (create_tmp_var_name (prefix), NULL_TREE,
type, NULL_TREE,