From a0a10853345a395b64e44df41dbb743661301ef0 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 12 May 2015 10:21:47 +0200 Subject: [PATCH] [multiple changes] 2015-05-12 Tristan Gingold * i-cpoint.adb (Copy_Terminated_Array): Copy nothing if Length is 0. 2015-05-12 Ed Schonberg * sem_ch3.adb (Complete_Private_Subtype): Propagate Has_Delayed_Aspects flag from private to full view, to ensure that predicate functions are constructed. 2015-05-12 Ed Schonberg * sem_ch6.adb (Process_Formals): If a tagged formal is an incomplete class-wide type, the subprogram must have a delayed freeze even though the opertation is not a primitive of the type. THis ensures that the backend can recover the full view when elaborating the subprogram declaration. 2015-05-12 Ed Schonberg * exp_util.adb (Get_Current_Value_Condition): Nothing to be done if an elsif part has been rewritten so that it is not part of an enclosing if_statement. From-SVN: r223040 --- gcc/ada/ChangeLog | 24 ++++++++++++++++++++++++ gcc/ada/exp_util.adb | 7 +++++++ gcc/ada/i-cpoint.adb | 9 +++++---- gcc/ada/sem_ch3.adb | 13 +++++++++++-- gcc/ada/sem_ch6.adb | 12 +++++++----- 5 files changed, 54 insertions(+), 11 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b98c272eed3..29ee945b67a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,27 @@ +2015-05-12 Tristan Gingold + + * i-cpoint.adb (Copy_Terminated_Array): Copy nothing if Length is 0. + +2015-05-12 Ed Schonberg + + * sem_ch3.adb (Complete_Private_Subtype): Propagate + Has_Delayed_Aspects flag from private to full view, to ensure + that predicate functions are constructed. + +2015-05-12 Ed Schonberg + + * sem_ch6.adb (Process_Formals): If a tagged formal is an + incomplete class-wide type, the subprogram must have a delayed + freeze even though the opertation is not a primitive of the + type. THis ensures that the backend can recover the full view + when elaborating the subprogram declaration. + +2015-05-12 Ed Schonberg + + * exp_util.adb (Get_Current_Value_Condition): Nothing to be + done if an elsif part has been rewritten so that it is not part + of an enclosing if_statement. + 2015-05-12 Robert Dewar * sem_type.adb, sem_ch10.adb, freeze.adb, sem_ch6.adb, exp_disp.adb: diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 6a7f052f0a6..c487b729b69 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -3366,6 +3366,13 @@ package body Exp_Util is Stm := Parent (CV); + -- If the tree has been otherwise rewritten there is nothing + -- else to be done either. + + if Nkind (Stm) /= N_If_Statement then + return; + end if; + -- Before start of ELSIF part if Loc < Sloc (CV) then diff --git a/gcc/ada/i-cpoint.adb b/gcc/ada/i-cpoint.adb index 8da412bdea7..ddf33dae6fe 100644 --- a/gcc/ada/i-cpoint.adb +++ b/gcc/ada/i-cpoint.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -151,11 +151,12 @@ package body Interfaces.C.Pointers is raise Dereference_Error; end if; - -- Compute array length (including the terminator) + -- Compute array limited length (including the terminator) - L := 1; - while S.all /= Terminator and then L < Limit loop + L := 0; + while L < Limit loop L := L + 1; + exit when S.all = Terminator; Increment (S); end loop; diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index addfc0a56c3..b8a74d12273 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -11625,7 +11625,8 @@ package body Sem_Ch3 is -- Freeze the private subtype entity if its parent is delayed, and not -- already frozen. We skip this processing if the type is an anonymous -- subtype of a record component, or is the corresponding record of a - -- protected type, since ??? + -- protected type, since these are processed when the enclosing type + -- is frozen. if not Is_Type (Scope (Full)) then Set_Has_Delayed_Freeze (Full, @@ -11804,11 +11805,19 @@ package body Sem_Ch3 is -- Make sure Has_Predicates is set on full type if it is set on the -- private type. Note that it may already be set on the full type and - -- if so, we don't want to unset it. + -- if so, we don't want to unset it. Similarly, propagate information + -- about delayed aspects, because the corresponding pragmas must be + -- analyzed when one of the views is frozen. This last step is needed + -- in particular when the full type is a scalar type for which an + -- anonymous base type is constructed. if Has_Predicates (Priv) then Set_Has_Predicates (Full); end if; + + if Has_Delayed_Aspects (Priv) then + Set_Has_Delayed_Aspects (Full); + end if; end Complete_Private_Subtype; ---------------------------- diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index dcbee8cbd86..7d6c7069761 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -10206,7 +10206,9 @@ package body Sem_Ch6 is -- it is still the case that untagged incomplete types cannot -- be Taft-amendment types and must be completed in private -- part, so the subprogram must appear in the list of private - -- dependents of the type. + -- dependents of the type. If the type is class-wide, it is + -- not a primitive, but the freezing of the subprogram must + -- also be delayed to force the creation of a freeze node. if Is_Tagged_Type (Formal_Type) or else (Ada_Version >= Ada_2012 @@ -10215,15 +10217,15 @@ package body Sem_Ch6 is then if Ekind (Scope (Current_Scope)) = E_Package and then not Is_Generic_Type (Formal_Type) - and then not Is_Class_Wide_Type (Formal_Type) then if not Nkind_In (Parent (T), N_Access_Function_Definition, N_Access_Procedure_Definition) then - Append_Elmt - (Current_Scope, - To => Private_Dependents (Base_Type (Formal_Type))); + if not Is_Class_Wide_Type (Formal_Type) then + Append_Elmt (Current_Scope, + Private_Dependents (Base_Type (Formal_Type))); + end if; -- Freezing is delayed to ensure that Register_Prim -- will get called for this operation, which is needed -- 2.30.2