]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sem_ch10.adb (Analyze_Compilation_Unit): For a library subprogram body that acts...
authorThomas Quinot <quinot@adacore.com>
Fri, 2 Dec 2011 14:56:34 +0000 (14:56 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 2 Dec 2011 14:56:34 +0000 (15:56 +0100)
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).

From-SVN: r181918

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

index d0eba3833438d2036cdec8dbf4242997df4c4fa0..9ad5b1be173ee937077feda71c339c9f10717768 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 4913b13e00ea494ba4ed03cba72b7928a25756d4..27d9e45b93bb54507ec9e8104b7e6d9e30485a9a 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 =>