From: Gary Dismukes Date: Fri, 5 Sep 2025 20:58:54 +0000 (+0000) Subject: ada: Incorrect expansion of VADS Size attribute applied to an array type X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b0f15d09da63effeb92d3d59f39bfab3c664bcaf;p=thirdparty%2Fgcc.git ada: Incorrect expansion of VADS Size attribute applied to an array type The compiler fails, either with an Assert_Failure (for a compiler with assertions enabled) or by producing a bad value, when processing a VADS_Size attribute (or a Size attribute when pragma Use_VADS_Size is in force), in the case where the prefix denotes a composite type or subtype whose object size (Esise) is not known by the front end. The bug is due to Eval_Attribute attempting to fold a VADS-related size attribute even when Esize is not yet known for the type. gcc/ada/ChangeLog: * sem_attr.adb (Eval_Attribute): In the case of a VADS-specific size attribute, only fold to the object size when the Esize field is known. --- diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index e08dc42d903..bde4d40dcb5 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -10493,10 +10493,10 @@ package body Sem_Attr is Fold_Uint (N, Expr_Value (Expression (S)), Static); -- If no size is specified, then we simply use the object - -- size in the VADS_Size case (e.g. Natural'Size is equal - -- to Integer'Size, not one less). + -- size (when known) in the VADS_Size case (for example, + -- Natural'Size is equal to Integer'Size, not one less). - else + elsif Known_Esize (P_TypeA) then Fold_Uint (N, Esize (P_TypeA), Static); end if; end;