aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2017-05-02 10:18:17 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2017-05-02 10:18:17 +0200
commit42fe76e063c39eca13f26fb73f6bbbb612dcb4f8 (patch)
tree9ae53dabdf1fb87c1072cb708923b201947301cf
parent676be6a33532f7aaa97038d36e2cc737f9b8799f (diff)
downloadgcc-42fe76e063c39eca13f26fb73f6bbbb612dcb4f8.zip
gcc-42fe76e063c39eca13f26fb73f6bbbb612dcb4f8.tar.gz
gcc-42fe76e063c39eca13f26fb73f6bbbb612dcb4f8.tar.bz2
[multiple changes]
2017-05-02 Eric Botcazou <ebotcazou@adacore.com> * freeze.adb (Check_Component_Storage_Order): Do not treat bit-packed array components specially. 2017-05-02 Ed Schonberg <schonberg@adacore.com> * 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
-rw-r--r--gcc/ada/ChangeLog12
-rw-r--r--gcc/ada/freeze.adb10
-rw-r--r--gcc/ada/sem_ch8.adb8
3 files changed, 21 insertions, 9 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 3c7dd63..daf086f 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,15 @@
+2017-05-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ * freeze.adb (Check_Component_Storage_Order): Do not treat bit-packed
+ array components specially.
+
+2017-05-02 Ed Schonberg <schonberg@adacore.com>
+
+ * 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 <ebotcazou@adacore.com>
* gcc-interface/decl.c (components_to_record): Add missing guard.
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 9c48644..e072824 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 03a21c2..f765bb8 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;