aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2016-05-02 20:33:47 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2016-05-02 20:33:47 +0000
commitc10e34e8015b3893b043b2df450c51730be9aeca (patch)
treeb8eee0a4f77003bde0bcc48996c57e350f5416df
parent351f3d8aa1e77f908980c5cfc0c816c78ef6e00b (diff)
PR ada/70900
Backport from mainline 2016-04-18 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Process_Formals): Do not set a delay freeze on a subprogram that returns a class-wide type, if the subprogram is a compilation unit, because otherwise gigi will treat the subprogram as external, leading to link errors. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@235789 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog11
-rw-r--r--gcc/ada/sem_ch6.adb4
2 files changed, 14 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 1ff0f4a47ba..748f7e4be29 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,14 @@
+2016-04-28 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR ada/70900
+ Backport from mainline
+ 2016-04-18 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (Process_Formals): Do not set a delay freeze on
+ a subprogram that returns a class-wide type, if the subprogram
+ is a compilation unit, because otherwise gigi will treat the
+ subprogram as external, leading to link errors.
+
2016-05-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* gcc-interface/Makefile.in (install-gcc-specs): Use foreach.
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 9474ef57af5..a5003bb78c4 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -10415,10 +10415,12 @@ package body Sem_Ch6 is
Analyze_Return_Type (Related_Nod);
-- If return type is class-wide, subprogram freezing may be
- -- delayed as well.
+ -- delayed as well, unless the declaration is a compilation unit
+ -- in which case the freeze node would appear too late.
if Is_Class_Wide_Type (Etype (Current_Scope))
and then not Is_Thunk (Current_Scope)
+ and then not Is_Compilation_Unit (Current_Scope)
and then Nkind (Unit_Declaration_Node (Current_Scope)) =
N_Subprogram_Declaration
then