aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch13.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2016-07-04 12:00:57 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2016-07-04 12:00:57 +0200
commit10edebe7b49ee1903bca94e03d4cf9c8194c3905 (patch)
tree8d1354391447c45564cc3f27fcc976c07d89e6bd /gcc/ada/exp_ch13.adb
parent15f6e0dac34a243341fba80f8ebdaeec78d766fe (diff)
downloadgcc-10edebe7b49ee1903bca94e03d4cf9c8194c3905.zip
gcc-10edebe7b49ee1903bca94e03d4cf9c8194c3905.tar.gz
gcc-10edebe7b49ee1903bca94e03d4cf9c8194c3905.tar.bz2
[multiple changes]
2016-07-04 Hristian Kirtchev <kirtchev@adacore.com> * exp_aggr.adb (Ctrl_Init_Expression): New routine. (Gen_Assign): Code cleanup. Perform in-place side effect removal when the expression denotes a controlled function call. * exp_util.adb (Remove_Side_Effects): Do not remove side effects on a function call which has this behavior suppressed. * sem_aggr.adb Code cleanup. * sinfo.adb (No_Side_Effect_Removal): New routine. (Set_Side_Effect_Removal): New routine. * sinfo.ads New attribute No_Side_Effect_Removal along with occurences in nodes. (No_Side_Effect_Removal): New routine along with pragma Inline. (Set_Side_Effect_Removal): New routine along with pragma Inline. 2016-07-04 Arnaud Charlet <charlet@adacore.com> * opt.ads, sem_prag.adb (Universal_Addressing_On_AAMP): Removed. Remove support for pragma No_Run_Time. Update comments. 2016-07-04 Pascal Obry <obry@adacore.com> * g-forstr.ads: More documentation for the Formatted_String support. 2016-07-04 Ed Schonberg <schonberg@adacore.com> * exp_ch13.adb (Expand_N_Attribute_Definition_Clause, case 'Address): If the address comes from an aspect specification and not a source attribute definition clause, do not remove side effects from the expression, because the expression must be elaborated at the freeze point of the object and not at the object declaration, because of the delayed analysis of aspect specifications. From-SVN: r237959
Diffstat (limited to 'gcc/ada/exp_ch13.adb')
-rw-r--r--gcc/ada/exp_ch13.adb9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch13.adb b/gcc/ada/exp_ch13.adb
index 11e75f3..dd004a0 100644
--- a/gcc/ada/exp_ch13.adb
+++ b/gcc/ada/exp_ch13.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -136,9 +136,16 @@ package body Exp_Ch13 is
-- has a delayed freeze, but the address expression itself
-- must be elaborated at the point it appears. If the object
-- is controlled, additional checks apply elsewhere.
+ -- If the attribute comes from an aspect specification it
+ -- is being elaborated at the freeze point and side effects
+ -- need not be removed (and shouldn't, if the expression
+ -- depends on other entities that have delayed freeze).
+ -- This is another consequence of the delayed analysis of
+ -- aspects, and a real semantic difference.
elsif Nkind (Decl) = N_Object_Declaration
and then not Needs_Constant_Address (Decl, Typ)
+ and then not From_Aspect_Specification (N)
then
Remove_Side_Effects (Exp);
end if;