]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Plug loophole exposed by previous change
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 23 Aug 2024 07:44:06 +0000 (09:44 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 3 Sep 2024 08:16:52 +0000 (10:16 +0200)
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.

gcc/ada/gcc-interface/trans.cc

index caa0f56a34d9e46a106662db4778b7ba925fac5d..fadd6b483d5a844454c87964a815693d6de45a07 100644 (file)
@@ -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,