From: Arnaud Charlet Date: Tue, 2 May 2017 08:18:17 +0000 (+0200) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=42fe76e063c39eca13f26fb73f6bbbb612dcb4f8;p=gcc.git [multiple changes] 2017-05-02 Eric Botcazou * freeze.adb (Check_Component_Storage_Order): Do not treat bit-packed array components specially. 2017-05-02 Ed Schonberg * sem_ch8.adb (Premature_Usage): If the premature usage of an entity is as the expression in its own object decaration, rewrite the reference as Any_Id to prevent cascaded errors or compiler loops when such an entity is used in an address clause. From-SVN: r247462 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3c7dd63ff62..daf086f41e7 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,15 @@ +2017-05-02 Eric Botcazou + + * freeze.adb (Check_Component_Storage_Order): Do not treat bit-packed + array components specially. + +2017-05-02 Ed Schonberg + + * sem_ch8.adb (Premature_Usage): If the premature usage of + an entity is as the expression in its own object decaration, + rewrite the reference as Any_Id to prevent cascaded errors or + compiler loops when such an entity is used in an address clause. + 2017-05-01 Eric Botcazou * gcc-interface/decl.c (components_to_record): Add missing guard. diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 9c48644b42b..e072824a486 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -1267,18 +1267,10 @@ package body Freeze is -- Component SSO differs from enclosing composite: - -- Reject if component is a bit-packed array, as it is represented - -- as a scalar internally. - - if Is_Bit_Packed_Array (Comp_Base) then - Error_Msg_N - ("type of packed component must have same scalar storage " - & "order as enclosing composite", Err_Node); - -- Reject if composite is a bit-packed array, as it is rewritten -- into an array of scalars. - elsif Is_Bit_Packed_Array (Encl_Base) then + if Is_Bit_Packed_Array (Encl_Base) then Error_Msg_N ("type of packed array must have same scalar storage order " & "as component", Err_Node); diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 03a21c21e0b..f765bb8dda3 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -8562,6 +8562,14 @@ package body Sem_Ch8 is else Error_Msg_N ("object& cannot be used before end of its declaration!", N); + + -- If the premature reference appears as the expression in its own + -- declaration, rewrite it to prevent compiler loops in subsequent + -- uses of this mangled declaration in address clauses. + + if Nkind (Parent (N)) = N_Object_Declaration then + Set_Entity (N, Any_Id); + end if; end if; end Premature_Usage;