OSDN Git Service

2011-12-02 Thomas Quinot <quinot@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 2 Dec 2011 14:56:34 +0000 (14:56 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 2 Dec 2011 14:56:34 +0000 (14:56 +0000)
* sem_ch10.adb (Analyze_Compilation_Unit): For a library subprogram
body that acts as spec, do not create a shallow copy of the context
clause for the synthetized spec (instead, use the same list as
in the body).

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181918 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/sem_ch10.adb

index d0eba38..9ad5b1b 100644 (file)
@@ -1,3 +1,10 @@
+2011-12-02  Thomas Quinot  <quinot@adacore.com>
+
+       * sem_ch10.adb (Analyze_Compilation_Unit): For a library subprogram
+       body that acts as spec, do not create a shallow copy of the context
+       clause for the synthetized spec (instead, use the same list as
+       in the body).
+
 2011-12-02  Bob Duff  <duff@adacore.com>
 
        * gnat_ugn.texi: Clarify usage of -p binder switch.
index 4913b13..27d9e45 100644 (file)
@@ -807,9 +807,20 @@ package body Sem_Ch10 is
 
                   begin
                      Set_Comes_From_Source_Default (False);
+
+                     --  Checks for redundant USE TYPE clauses have a special
+                     --  exception for the synthetic spec we create here. This
+                     --  special case relies on the two compilation units
+                     --  sharing the same context clause.
+
+                     --  Note: We used to do a shallow copy (New_Copy_List),
+                     --  which defeated those checks and also created malformed
+                     --  trees (subtype mark shared by two distinct
+                     --  N_Use_Type_Clause nodes) which crashed the compiler.
+
                      Lib_Unit :=
                        Make_Compilation_Unit (Loc,
-                         Context_Items => New_Copy_List (Context_Items (N)),
+                         Context_Items => Context_Items (N),
                          Unit =>
                            Make_Subprogram_Declaration (Sloc (N),
                              Specification =>