]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Get rid of secondary stack for indefinite record types with size clause
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 29 Mar 2024 12:29:54 +0000 (13:29 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 20 May 2024 07:47:06 +0000 (09:47 +0200)
commitefc7ba5f8f113565b47214d0ffdb27a6638ab8b6
treeeda530b1ea6288cdf8307f8b09e898e2c3de38eb
parentcee232f4bf2e7d6891ec68c0100ecc5063e3e748
ada: Get rid of secondary stack for indefinite record types with size clause

This change eliminates the use of the secondary stack for indefinite record
types for which a valid (object) size clause is specified.  In accordance
with the RM, the compiler accepts (object) size clauses on such types only
if all the components, including those of the variants of the variant part
if any, have a size known at compile time, and only if the clauses specify
a value that is at least as large as the largest possible size of objects
of the types when all the variants are considered.  However, it would still
have used the secondary stack, despite valid (object) size clauses, before
the change, as soon as a variant part was present in the types.

gcc/ada/

* freeze.ads (Check_Compile_Time_Size): Remove obsolete description
of usage for the Size_Known_At_Compile_Time flag.
* freeze.adb (Check_Compile_Time_Size.Size_Known): In the case where
a variant part is present, do not return False if Esize is known.
* sem_util.adb (Needs_Secondary_Stack.Caller_Known_Size_Record): Add
missing "Start of processing" comment.  Return true if either a size
clause or an object size clause has been given for the first subtype
of the type.
gcc/ada/freeze.adb
gcc/ada/freeze.ads
gcc/ada/sem_util.adb