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.
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;