ada: Missing constraint check for initial value of object with address clause
commit2ccf77d982d41dda5d352e99d67f901d1cfb7668
authorSteve Baird <baird@adacore.com>
Fri, 5 Apr 2024 19:35:08 +0000 (5 12:35 -0700)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 21 May 2024 07:26:49 +0000 (21 09:26 +0200)
tree8bb5e9909383984241d0345b17b0e45684353f42
parent8cadfeb5f6d7d15cb3d008b11105a2e67b46dbe9
ada: Missing constraint check for initial value of object with address clause

In some cases where an object is declared with an initial value that is
an aggregate and also with a specified Address (either via an
aspect_specification or via an attribute_definition_clause), the
check that the initial value satisfies the constraints of the object's
subtype was incorrectly omitted.

gcc/ada/

* exp_util.adb (Remove_Side_Effects): Make_Reference assumes that
the referenced object satisfies the constraints of the designated
subtype of the access type. Ensure that this assumption holds by
introducing a qualified expression if needed (and then ensuring
that checking associated with evaluation of the qualified
expression is not suppressed).
gcc/ada/exp_util.adb