From 82701811fcb7027114db712f6b06b742fc5557d1 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 4 Aug 2014 12:41:40 +0200 Subject: [PATCH] [multiple changes] 2014-08-04 Robert Dewar * sem_ch3.adb, einfo.ads: Minor reformatting. 2014-08-04 Yannick Moy * inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Fix detection of subprograms that cannot be inlined in GNATprove mode. 2014-08-04 Ed Schonberg * einfo.adb: Add guard to Returns_Limited_View. 2014-08-04 Jose Ruiz * s-tassta.adb, s-tarest.adb (Task_Wrapper): Force maximum alignment of the secondary stack to respect the alignments of the returned objects. From-SVN: r213565 --- gcc/ada/ChangeLog | 18 ++++++++++++++++++ gcc/ada/einfo.adb | 2 ++ gcc/ada/einfo.ads | 14 +++++++------- gcc/ada/inline.adb | 19 ++++++++++++++++++- gcc/ada/s-tarest.adb | 1 + gcc/ada/s-tassta.adb | 1 + gcc/ada/sem_ch3.adb | 1 + 7 files changed, 48 insertions(+), 8 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c45e77a..26d63fa 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,21 @@ +2014-08-04 Robert Dewar + + * sem_ch3.adb, einfo.ads: Minor reformatting. + +2014-08-04 Yannick Moy + + * inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Fix + detection of subprograms that cannot be inlined in GNATprove mode. + +2014-08-04 Ed Schonberg + + * einfo.adb: Add guard to Returns_Limited_View. + +2014-08-04 Jose Ruiz + + * s-tassta.adb, s-tarest.adb (Task_Wrapper): Force maximum alignment of + the secondary stack to respect the alignments of the returned objects. + 2014-08-04 Ed Schonberg * einfo.ads, einfo.adb (Returns_Limited_View): New flag defined diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb index f3899a9..d4a5260 100644 --- a/gcc/ada/einfo.adb +++ b/gcc/ada/einfo.adb @@ -2872,6 +2872,7 @@ package body Einfo is function Returns_Limited_View (Id : E) return B is begin + pragma Assert (Ekind (Id) = E_Function); return Flag134 (Id); end Returns_Limited_View; @@ -5701,6 +5702,7 @@ package body Einfo is procedure Set_Returns_Limited_View (Id : E; V : B := True) is begin + pragma Assert (Ekind (Id) = E_Function); Set_Flag134 (Id, V); end Set_Returns_Limited_View; diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index 14bb0d0..491e84d 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -3767,15 +3767,15 @@ package Einfo is -- even though it causes the whole function to return. -- Returns_By_Ref (Flag90) --- Defined in function entities, to indicate that the function --- returns the result by reference, either because its return type is a --- by-reference-type or because it uses explicitly the secondary stack. +-- Defined in function entities. Set if the function returns the result +-- by reference, either because its return type is a by-reference-type +-- or because the function explicitly uses the secondary stack. -- Returns_Limited_View (Flag134) --- Defined on function entities, to indicate that the return type of --- the function at the point of definition is a limited view. Used to --- handle the late freezing of the function, when it is called in the --- current semantic unit while it is still unfrozen. +-- Defined in function entities. Set if the return type of the function +-- at the point of definition is a limited view. Used to handle the late +-- freezing of the function when it is called in the current semantic +-- unit while it is still unfrozen. -- Reverse_Bit_Order (Flag164) [base type only] -- Defined in all record type entities. Set if entity has a Bit_Order diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index 7a3b2a7..022bc76 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -1382,6 +1382,9 @@ package body Inline is -- Returns True if subprogram Id has any contract (Pre, Post, Global, -- Depends, etc.) + function Is_Unit_Subprogram (Id : Entity_Id) return Boolean; + -- Returns True if subprogram Id defines a compilation unit + function In_Package_Visible_Spec (Id : Node_Id) return Boolean; -- Returns True if subprogram Id is defined in the visible part of a -- package specification. @@ -1436,6 +1439,20 @@ package body Inline is return Nkind (Original_Node (Decl)) = N_Expression_Function; end Is_Expression_Function; + ------------------------ + -- Is_Unit_Subprogram -- + ------------------------ + + function Is_Unit_Subprogram (Id : Entity_Id) return Boolean is + Decl : Node_Id := Parent (Parent (Id)); + begin + if Nkind (Parent (Id)) = N_Defining_Program_Unit_Name then + Decl := Parent (Decl); + end if; + + return Nkind (Parent (Decl)) = N_Compilation_Unit; + end Is_Unit_Subprogram; + -- Local declarations Id : Entity_Id; -- Procedure or function entity for the subprogram @@ -1462,7 +1479,7 @@ package body Inline is -- Do not inline unit-level subprograms - if Nkind (Parent (Id)) = N_Defining_Program_Unit_Name then + if Is_Unit_Subprogram (Id) then return False; -- Do not inline subprograms declared in the visible part of a package diff --git a/gcc/ada/s-tarest.adb b/gcc/ada/s-tarest.adb index c746ab9..d8478fa 100644 --- a/gcc/ada/s-tarest.adb +++ b/gcc/ada/s-tarest.adb @@ -210,6 +210,7 @@ package body System.Tasking.Restricted.Stages is Secondary_Stack : aliased SSE.Storage_Array (1 .. Self_ID.Common.Compiler_Data.Pri_Stack_Info.Size * SSE.Storage_Offset (Parameters.Sec_Stack_Percentage) / 100); + for Secondary_Stack'Alignment use Standard'Maximum_Alignment; pragma Warnings (Off); Secondary_Stack_Address : System.Address := Secondary_Stack'Address; diff --git a/gcc/ada/s-tassta.adb b/gcc/ada/s-tassta.adb index 1cf83da..971879c 100644 --- a/gcc/ada/s-tassta.adb +++ b/gcc/ada/s-tassta.adb @@ -1052,6 +1052,7 @@ package body System.Tasking.Stages is SSE.Storage_Offset (Parameters.Sec_Stack_Percentage) / 100; Secondary_Stack : aliased SSE.Storage_Array (1 .. Secondary_Stack_Size); + for Secondary_Stack'Alignment use Standard'Maximum_Alignment; -- Actual area allocated for secondary stack Secondary_Stack_Address : System.Address := Secondary_Stack'Address; diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 94e4510..d94ae26 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -6909,6 +6909,7 @@ package body Sem_Ch3 is -- and the full derivation can only be its underlying full view. Build_Full_Derivation; + if not Is_Completion then Set_Full_View (Derived_Type, Full_Der); else -- 2.7.4