From 0444d0671d2696d9a3eef8ce01fe77f82702c0e3 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 9 Oct 2018 15:06:11 +0000 Subject: [Ada] Internal error on inlined renaming of subprogram instance This fixes a recent regression introduced in the compiler for the inlined renaming of a subprogram instantiated in a package body. It was wrongly clearing the Is_Public flag on the entity associated with the body. 2018-10-09 Eric Botcazou gcc/ada/ * sem_ch7.adb (Has_Referencer): Add comment for the N_Freeze_Entity case. Do not rely on Has_Referencer_Of_Non_Subprograms to clear the Is_Public flag on subprogram entities. gcc/testsuite/ * gnat.dg/inline14.adb, gnat.dg/inline14_pkg.adb, gnat.dg/inline14_pkg.ads: New testcase. From-SVN: r264975 --- gcc/ada/ChangeLog | 7 +++++++ gcc/ada/sem_ch7.adb | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'gcc/ada') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 04b506e..2c0bce6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2018-10-09 Eric Botcazou + + * sem_ch7.adb (Has_Referencer): Add comment for the + N_Freeze_Entity case. Do not rely on + Has_Referencer_Of_Non_Subprograms to clear the Is_Public flag on + subprogram entities. + 2018-10-09 Ed Schonberg * exp_unst.adb (In_Synchronized_Call): Handle properly private diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index 8aebb0f..6e9f531 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -441,7 +441,13 @@ package body Sem_Ch7 is Discard : Boolean; pragma Unreferenced (Discard); begin - -- Inspect the actions to find references to subprograms + -- Inspect the actions to find references to subprograms. + -- We assume that the actions do not contain other kinds + -- of references and, therefore, we do not stop the scan + -- or set Has_Referencer_Of_Non_Subprograms here. Doing + -- it would pessimize common cases for which the actions + -- contain the declaration of an init procedure, since + -- such a procedure is automatically marked inline. Discard := Has_Referencer (Actions (Decl), @@ -470,7 +476,8 @@ package body Sem_Ch7 is and then not Is_Exported (Decl_Id) and then No (Interface_Name (Decl_Id)) and then - (not Has_Referencer_Of_Non_Subprograms + ((Nkind (Decl) /= N_Subprogram_Declaration + and then not Has_Referencer_Of_Non_Subprograms) or else (Nkind (Decl) = N_Subprogram_Declaration and then not Subprogram_Table.Get (Decl_Id))) then -- cgit v1.1