From: Eric Botcazou Date: Mon, 12 Aug 2019 09:00:04 +0000 (+0000) Subject: [Ada] Improve error message for Object_Size clause on dynamic array X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=62f0fa2170c3875c28171caa4e1ce3a16a0dc18b;p=gcc.git [Ada] Improve error message for Object_Size clause on dynamic array This makes the compiler issue the same error: size clause not allowed for variable length type for an Object_Size clause on a variable-sized type as for a Size clause, for example on the following procedure: procedure P (X, Y : Integer) is subtype Sub is String (X .. Y) with Object_Size => 64; begin null; end; 2019-08-12 Eric Botcazou gcc/ada/ * freeze.adb (Freeze_Entity): Give the same error for an Object_Size clause on a variable-sized type as for a Size clause. From-SVN: r274294 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 4e76edffc17..d1e74ab0ded 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2019-08-12 Eric Botcazou + + * freeze.adb (Freeze_Entity): Give the same error for an + Object_Size clause on a variable-sized type as for a Size + clause. + 2019-08-12 Gary Dismukes * sem_prag.adb (Analyze_Pragma, Pragma_Suppress_Initialization): diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 00d20e90169..e4d52f6e10f 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -6803,7 +6803,7 @@ package body Freeze is -- Do not allow a size clause for a type which does not have a size -- that is known at compile time - if Has_Size_Clause (E) + if (Has_Size_Clause (E) or else Has_Object_Size_Clause (E)) and then not Size_Known_At_Compile_Time (E) then -- Suppress this message if errors posted on E, even if we are