diff options
-rw-r--r-- | gcc/ada/freeze.adb | 1 | ||||
-rw-r--r-- | gcc/ada/freeze.ads | 11 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 12 |
3 files changed, 18 insertions, 6 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 26e9d01..ea6106e 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -1077,6 +1077,7 @@ package body Freeze is and then No (Discriminant_Default_Value (First_Discriminant (T))) and then not Known_RM_Size (T) + and then not Known_Esize (T) then return False; end if; diff --git a/gcc/ada/freeze.ads b/gcc/ada/freeze.ads index fc0b767..066d8f0 100644 --- a/gcc/ada/freeze.ads +++ b/gcc/ada/freeze.ads @@ -156,17 +156,16 @@ package Freeze is -- RM_Size field is set to the required size, allowing for possible front -- end packing of an array using this type as a component type. -- - -- Note: the flag Size_Known_At_Compile_Time is used to determine if the - -- secondary stack must be used to return a value of the type, and also - -- to determine whether a component clause is allowed for a component - -- of the given type. - -- - -- Note: this is public because of one dubious use in Sem_Res??? + -- Note: the flag Size_Known_At_Compile_Time is used to determine whether a + -- size clause is allowed for the type, and also whether a component clause + -- is allowed for a component of the type. -- -- Note: Check_Compile_Time_Size does not test the case of the size being -- known because a size clause is specifically given. That is because we -- do not allow a size clause if the size would not otherwise be known at -- compile time in any case. + -- + -- ??? This is public because of dubious uses in Sem_Ch3 and Sem_Res procedure Check_Inherited_Conditions (R : Entity_Id; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 0935827..15994b4 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -22409,6 +22409,8 @@ package body Sem_Util is return False; end Depends_On_Discriminant; + -- Start of processing for Caller_Known_Size_Record + begin -- This is a protected type without Corresponding_Record_Type set, -- typically because expansion is disabled. The safe thing to do is @@ -22418,6 +22420,16 @@ package body Sem_Util is return True; end if; + -- If either size is specified for the type, then it's known in the + -- caller in particular. Note that, even if the clause is confirming, + -- this does not change the outcome since the size was already known. + + if Has_Size_Clause (First_Subtype (Typ)) + or else Has_Object_Size_Clause (First_Subtype (Typ)) + then + return True; + end if; + -- First see if we have a variant part and return False if it depends -- on discriminants. |