From ed962eda60df47f3b03e1a41a419c48e6fce1bb3 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 26 Oct 2015 12:07:51 +0100 Subject: [PATCH] [multiple changes] 2015-10-26 Hristian Kirtchev * sem_util.adb (Is_Suspension_Object): Ensure that the scope of "Ada" is Standard_Standard. 2015-10-26 Hristian Kirtchev * sem_res.adb (Is_OK_Volatile_Context): A subprogram call is an OK context for a reference to an effectively volatile object. (Resolve_Actuals): Add references to SPARK RM. (Within_Procedure_Call): Removed. (Within_Subprogram_Call): New routine. 2015-10-26 Ed Schonberg * sem_ch6.adb (Check_Aggregate_Accessibility): A reference to a formal parameter in an aggregate does not need an accesibility check only if the formal is aliased. From-SVN: r229329 --- gcc/ada/ChangeLog | 19 +++++++++++++++++++ gcc/ada/sem_ch6.adb | 5 ++++- gcc/ada/sem_res.adb | 33 ++++++++++++++++++--------------- gcc/ada/sem_util.adb | 4 +++- 4 files changed, 44 insertions(+), 17 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9b619987a8f..0a88e17c9e0 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,22 @@ +2015-10-26 Hristian Kirtchev + + * sem_util.adb (Is_Suspension_Object): Ensure that the scope of "Ada" + is Standard_Standard. + +2015-10-26 Hristian Kirtchev + + * sem_res.adb (Is_OK_Volatile_Context): A subprogram call is an OK + context for a reference to an effectively volatile object. + (Resolve_Actuals): Add references to SPARK RM. + (Within_Procedure_Call): Removed. + (Within_Subprogram_Call): New routine. + +2015-10-26 Ed Schonberg + + * sem_ch6.adb (Check_Aggregate_Accessibility): A reference to a + formal parameter in an aggregate does not need an accesibility + check only if the formal is aliased. + 2015-10-26 Claire Dross * sem_aux.ads (Number_Components): Can return 0 when called on diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 56a13defaeb..86363ca683e 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -661,10 +661,13 @@ package body Sem_Ch6 is Obj := Prefix (Obj); end loop; + -- No check needed for an aliased formal. + -- A run-time check may still be needed ??? + if Is_Entity_Name (Obj) and then Is_Formal (Entity (Obj)) + and then Is_Aliased (Entity (Obj)) then - -- A run-time check may be needed ??? null; elsif Object_Access_Level (Obj) > diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index b2d3ca0a5f0..7e73617ef08 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -4464,17 +4464,18 @@ package body Sem_Res is and then Comes_From_Source (A) and then Is_Effectively_Volatile_Object (A) then - -- An effectively volatile object may act as an actual - -- parameter when the corresponding formal is of a non-scalar - -- volatile type. + -- An effectively volatile object may act as an actual when the + -- corresponding formal is of a non-scalar volatile type + -- (SPARK RM 7.1.3(12)). if Is_Volatile (Etype (F)) and then not Is_Scalar_Type (Etype (F)) then null; - -- An effectively volatile object may act as an actual - -- parameter in a call to an instance of Unchecked_Conversion. + -- An effectively volatile object may act as an actual in a + -- call to an instance of Unchecked_Conversion. + -- (SPARK RM 7.1.3(12)). elsif Is_Unchecked_Conversion_Instance (Nam) then null; @@ -6843,7 +6844,7 @@ package body Sem_Res is function Within_Check (Nod : Node_Id) return Boolean; -- Determine whether an arbitrary node appears in a check node - function Within_Procedure_Call (Nod : Node_Id) return Boolean; + function Within_Subprogram_Call (Nod : Node_Id) return Boolean; -- Determine whether an arbitrary node appears in a procedure call function Within_Volatile_Function (Id : Entity_Id) return Boolean; @@ -6907,19 +6908,21 @@ package body Sem_Res is return False; end Within_Check; - --------------------------- - -- Within_Procedure_Call -- - --------------------------- + ---------------------------- + -- Within_Subprogram_Call -- + ---------------------------- - function Within_Procedure_Call (Nod : Node_Id) return Boolean is + function Within_Subprogram_Call (Nod : Node_Id) return Boolean is Par : Node_Id; begin - -- Climb the parent chain looking for a procedure call + -- Climb the parent chain looking for a function or procedure call Par := Nod; while Present (Par) loop - if Nkind (Par) = N_Procedure_Call_Statement then + if Nkind_In (Par, N_Function_Call, + N_Procedure_Call_Statement) + then return True; -- Prevent the search from going too far @@ -6932,7 +6935,7 @@ package body Sem_Res is end loop; return False; - end Within_Procedure_Call; + end Within_Subprogram_Call; ------------------------------ -- Within_Volatile_Function -- @@ -7049,10 +7052,10 @@ package body Sem_Res is return True; -- Assume that references to effectively volatile objects that appear - -- as actual parameters in a procedure call are always legal. A full + -- as actual parameters in a subprogram call are always legal. A full -- legality check is done when the actuals are resolved. - elsif Within_Procedure_Call (Context) then + elsif Within_Subprogram_Call (Context) then return True; -- Otherwise the context is not suitable for an effectively volatile diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 4a86c71ab59..313591add7a 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -11331,7 +11331,9 @@ package body Sem_Util is and then Present (Scope (Id)) and then Chars (Scope (Id)) = Name_Synchronous_Task_Control and then Present (Scope (Scope (Id))) - and then Chars (Scope (Scope (Id))) = Name_Ada; + and then Chars (Scope (Scope (Id))) = Name_Ada + and then Present (Scope (Scope (Scope (Id)))) + and then Scope (Scope (Scope (Id))) = Standard_Standard; end Is_Suspension_Object; -- Local variables -- 2.30.2