From: pmderodat Date: Tue, 11 Dec 2018 11:12:21 +0000 (+0000) Subject: [Ada] Unnesting: do not eliminate subprogram whose address is taken X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab5d137aab9357b075399be9d29cb8852350d963;p=thirdparty%2Fgcc.git [Ada] Unnesting: do not eliminate subprogram whose address is taken 2018-12-11 Ed Schonberg gcc/ada/ * exp_unst.adb (Register_Subprogram): A subprogram whose address is taken (through attribute Address or Access) is reachable and cannot be eliminated, even if there is no explicit call to it: the address may be used in an indirect call or in some address-related operation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@267014 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 59d0a3f76aaa..b16262327d83 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2018-12-11 Ed Schonberg + + * exp_unst.adb (Register_Subprogram): A subprogram whose address + is taken (through attribute Address or Access) is reachable and + cannot be eliminated, even if there is no explicit call to it: + the address may be used in an indirect call or in some + address-related operation. + 2018-12-11 Ed Schonberg * sem_util.adb (Get_Actual_Subtype): Function can return type diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb index f8c8fd56be11..a004b49d9eb4 100644 --- a/gcc/ada/exp_unst.adb +++ b/gcc/ada/exp_unst.adb @@ -770,7 +770,8 @@ package body Exp_Unst is ((Ent => E, Bod => Bod, Lev => L, - Reachable => In_Synchronized_Unit (E), + Reachable => In_Synchronized_Unit (E) + or else Address_Taken (E), Uplevel_Ref => L, Declares_AREC => False, Uents => No_Elist,