]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Change 'Size of formal unconstrained discriminated in out parameters
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 10 Dec 2025 20:40:27 +0000 (21:40 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 9 Jan 2026 10:57:16 +0000 (11:57 +0100)
commitcf0a79be059e5ad2d58ca6a30429ec90c4879ead
treee583831034c7bcebe7f0f2912bf76dc5385c51d3
parent76253776787099a656028cd7288f2e1b2a84e4d4
ada: Change 'Size of formal unconstrained discriminated in out parameters

When the discriminated type is declared with default discriminants, it is
definite, so objects of the type can be declared without constraints, are
thus unconstrained, and are allocated with the maximum size by GNAT.

When these objects are passed as actuals of formal in out parameters, it
makes sense for the 'Size computed for them from within the subprogram to
also be the above "unconstrained" size instead of the "constrained" size
computed from the value of the discriminants present in them.

gcc/ada/ChangeLog:

* exp_attr.adb (Expand_Size_Attribute): If the attribute is applied
to a formal parameter allocated with an extra Constrained parameter,
use the value of the latter to choose between the "unconstrained" or
the "constrained" size of the formal parameter.
gcc/ada/exp_attr.adb