aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2018-12-11 11:12:21 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-12-11 11:12:21 +0000
commitc13269965084ccb19233411164b52c7f187a5fb6 (patch)
tree5a7082978db677b3f2f747204dd384466001007d /gcc
parent2f42b6ead47da2c5d863042de6689aee64d342b3 (diff)
downloadgcc-c13269965084ccb19233411164b52c7f187a5fb6.zip
gcc-c13269965084ccb19233411164b52c7f187a5fb6.tar.gz
gcc-c13269965084ccb19233411164b52c7f187a5fb6.tar.bz2
[Ada] Unnesting: do not eliminate subprogram whose address is taken
2018-12-11 Ed Schonberg <schonberg@adacore.com> 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. From-SVN: r267014
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog8
-rw-r--r--gcc/ada/exp_unst.adb3
2 files changed, 10 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 59d0a3f..b162623 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,13 @@
2018-12-11 Ed Schonberg <schonberg@adacore.com>
+ * 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 <schonberg@adacore.com>
+
* sem_util.adb (Get_Actual_Subtype): Function can return type
mark.
(Get_Cursor_Type): Improve recovery and error message on a
diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb
index f8c8fd5..a004b49 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,