From b987f1dbef95c2c653df8f41a11df1ef3a650fb6 Mon Sep 17 00:00:00 2001 From: charlet Date: Fri, 2 Dec 2011 14:56:34 +0000 Subject: [PATCH] 2011-12-02 Thomas Quinot * 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 | 7 +++++++ gcc/ada/sem_ch10.adb | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d0eba383343..9ad5b1be173 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2011-12-02 Thomas Quinot + + * 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 * gnat_ugn.texi: Clarify usage of -p binder switch. diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index 4913b13e00e..27d9e45b93b 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -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 => -- 2.11.0