]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Pass parameters of full access unconstrained array types by copy in calls
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 12 Sep 2024 14:11:47 +0000 (16:11 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 25 Oct 2024 09:08:59 +0000 (11:08 +0200)
commit1c298fc41512a1062f348eb54d54d01697a66ffc
tree1e3a3d42cb98ca37c8042d5ca2f6fb968b163a2e
parent45ab93d9afaead934a6501f070d6ac60a6bf9dd2
ada: Pass parameters of full access unconstrained array types by copy in calls

When a full access array type is declared, either Volatile_Full_Access in
Ada 2012 or Atomic in Ada 2022, an implicit base array type is built by the
compiler with the Full_Access flag set, although full accesses cannot be
generated for objects of this type because the size is not known statically.

If the component type is a record with default values, an initialization
procedure taking a parameter of the base array type is built. Given that
full accesses cannot be generated for the parameter inside the procedure,
we need to pass the actual parameter by copy to the procedure in order to
implement the full access semantics.

gcc/ada/ChangeLog:

* exp_ch6.adb (Expand_Actuals.Is_Legal_Copy): Return True for an
initialization procedure with a full access formal parameter.
(Expand_Actuals.Requires_Atomic_Or_Volatile_Copy): Return True if
the formal parameter is of a full access unconstrained array type.
gcc/ada/exp_ch6.adb