From: Arnaud Charlet Date: Fri, 28 Apr 2017 13:48:59 +0000 (+0200) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=40b4bc2da16cd1145b77bbeb232a2d54b937a4a3;p=gcc.git [multiple changes] 2017-04-28 Ed Schonberg * sem_ch4.adb (Complete_Object_Operation): When rewriting the controlling actual in a prefixed call, preserve the original node information if the prefix itself has been rewritten, for ASIS use. 2017-04-28 Hristian Kirtchev * exp_ch6.adb (Insert_Post_Call_Actions): Code clean up. Insert the post-call actions after an enclosing procedure call when N denotes a function call and appears as an actual parameter in the procedure call. 2017-04-28 Eric Botcazou * freeze.adb (Check_Component_Storage_Order): If there is a clause for the component, also reject the attribute if the component doesn't end on a byte boundary and its scalar storage order is different from that of the enclosing record type. From-SVN: r247391 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 1ad8fbf53b4..d433c512112 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,23 @@ +2017-04-28 Ed Schonberg + + * sem_ch4.adb (Complete_Object_Operation): When rewriting the + controlling actual in a prefixed call, preserve the original node + information if the prefix itself has been rewritten, for ASIS use. + +2017-04-28 Hristian Kirtchev + + * exp_ch6.adb (Insert_Post_Call_Actions): + Code clean up. Insert the post-call actions after an enclosing + procedure call when N denotes a function call and appears as an + actual parameter in the procedure call. + +2017-04-28 Eric Botcazou + + * freeze.adb (Check_Component_Storage_Order): If there is a clause + for the component, also reject the attribute if the component + doesn't end on a byte boundary and its scalar storage order is + different from that of the enclosing record type. + 2017-04-28 Javier Miranda * atree.ads (Info_Messages): Removed. diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 36f43605fa2..0317dc39e21 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -7316,6 +7316,8 @@ package body Exp_Ch6 is ------------------------------ procedure Insert_Post_Call_Actions (N : Node_Id; Post_Call : List_Id) is + Context : constant Node_Id := Parent (N); + begin if Is_Empty_List (Post_Call) then return; @@ -7326,7 +7328,7 @@ package body Exp_Ch6 is -- call or indexing, i.e. an expression context as well. if not Is_List_Member (N) - or else Nkind_In (Parent (N), N_Function_Call, N_Indexed_Component) + or else Nkind_In (Context, N_Function_Call, N_Indexed_Component) then -- In Ada 2012 the call may be a function call in an expression -- (since OUT and IN OUT parameters are now allowed for such calls). @@ -7402,23 +7404,27 @@ package body Exp_Ch6 is -- corresponding statement list. else - declare - P : Node_Id; - - begin - P := Parent (N); - pragma Assert (Nkind_In (P, N_Entry_Call_Alternative, - N_Triggering_Alternative)); + pragma Assert (Nkind_In (Context, N_Entry_Call_Alternative, + N_Triggering_Alternative)); - if Is_Non_Empty_List (Statements (P)) then - Insert_List_Before_And_Analyze - (First (Statements (P)), Post_Call); - else - Set_Statements (P, Post_Call); - end if; - end; + if Is_Non_Empty_List (Statements (Context)) then + Insert_List_Before_And_Analyze + (First (Statements (Context)), Post_Call); + else + Set_Statements (Context, Post_Call); + end if; end if; + -- A procedure call is always part of a declarative or statement list, + -- however a function call may appear nested within a construct. Most + -- cases of function call nesting are handled in the special case above. + -- The only exception is when the function call acts as an actual in a + -- procedure call. In this case the function call is in a list, but the + -- post-call actions must be inserted after the procedure call. + + elsif Nkind (Context) = N_Procedure_Call_Statement then + Insert_Actions_After (Context, Post_Call); + -- Otherwise, normal case where N is in a statement sequence, just put -- the post-call stuff after the call statement. diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 5abbe39c1bd..9c48644b42b 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -1175,7 +1175,7 @@ package body Freeze is Comp_Byte_Aligned : Boolean; pragma Warnings (Off, Comp_Byte_Aligned); - -- Set for the record case, True if Comp starts on a byte boundary + -- Set for the record case, True if Comp is aligned on byte boundaries -- (in which case it is allowed to have different storage order). Comp_SSO_Differs : Boolean; @@ -1195,12 +1195,14 @@ package body Freeze is else -- If a component clause is present, check if the component starts - -- on a storage element boundary. Otherwise conservatively assume - -- it does so only in the case where the record is not packed. + -- and ends on byte boundaries. Otherwise conservatively assume it + -- does so only in the case where the record is not packed. if Present (Component_Clause (Comp)) then Comp_Byte_Aligned := - Normalized_First_Bit (Comp) mod System_Storage_Unit = 0; + (Normalized_First_Bit (Comp) mod System_Storage_Unit = 0) + and then + (Esize (Comp) mod System_Storage_Unit = 0); else Comp_Byte_Aligned := not Is_Packed (Encl_Type); end if; diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index a7362a74a68..4f2c1fd6c55 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -8621,6 +8621,14 @@ package body Sem_Ch4 is Actuals : List_Id; begin + -- Obj may already have been rewritten if it involves an implicit + -- dereference (e.g. if it is an access to a limited view). Preserve + -- a link to the original node for ASIS use. + + if not Comes_From_Source (Obj) then + Set_Original_Node (Dummy, Original_Node (Obj)); + end if; + -- Common case covering 1) Call to a procedure and 2) Call to a -- function that has some additional actuals.