summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-20 12:32:21 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-20 12:32:21 +0000
commit0c30cda1d6d5034e6107ff5a0dcb5026f4bceebb (patch)
tree2b73749a207274e9fa458dcff11244fce39124e7
parentb8eacb124b2ddc57ec8af4e86868801141aae4ab (diff)
downloadgcc-0c30cda1d6d5034e6107ff5a0dcb5026f4bceebb.tar.gz
2015-10-20 Ed Schonberg <schonberg@adacore.com>
* sem_ch11.adb (Analyze_Handled_Statements): If the scope is a postcondition subprogram, do not check for useless assignments because there are no source references in such a body, and the call will lose deferred references from the enclosing subprogram. 2015-10-20 Ed Schonberg <schonberg@adacore.com> * sem_ch13.adb: nalyze_Attribute_Definition_Clause, case 'Address): If either object is controlled the overlay is erroneous, but analysis must be completed so that back-end sees address clause and completes code generation. Improve text of warning. 2015-10-20 Thomas Quinot <quinot@adacore.com> * exp_ch4.adb: Minor reformatting. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229072 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog19
-rw-r--r--gcc/ada/exp_ch4.adb2
-rw-r--r--gcc/ada/sem_ch11.adb9
-rw-r--r--gcc/ada/sem_ch13.adb8
4 files changed, 32 insertions, 6 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 93dae231192..1c51c9feb63 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,22 @@
+2015-10-20 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch11.adb (Analyze_Handled_Statements): If the scope is a
+ postcondition subprogram, do not check for useless assignments
+ because there are no source references in such a body, and the
+ call will lose deferred references from the enclosing subprogram.
+
+2015-10-20 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch13.adb: nalyze_Attribute_Definition_Clause, case
+ 'Address): If either object is controlled the overlay is
+ erroneous, but analysis must be completed so that back-end sees
+ address clause and completes code generation. Improve text
+ of warning.
+
+2015-10-20 Thomas Quinot <quinot@adacore.com>
+
+ * exp_ch4.adb: Minor reformatting.
+
2015-10-20 Bob Duff <duff@adacore.com>
* s-mudido-affinity.adb (Create): Correct subranges of slices of CPU
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 0e789f2734e..9d4dff8d1ff 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -1536,7 +1536,7 @@ package body Exp_Ch4 is
if RTE_Available (Comp) then
-- Expand to a call only if the runtime function is available,
- -- otherwise fallback to inline code.
+ -- otherwise fall back to inline code.
Remove_Side_Effects (Op1, Name_Req => True);
Remove_Side_Effects (Op2, Name_Req => True);
diff --git a/gcc/ada/sem_ch11.adb b/gcc/ada/sem_ch11.adb
index 86285ee018b..0b9f8ef829d 100644
--- a/gcc/ada/sem_ch11.adb
+++ b/gcc/ada/sem_ch11.adb
@@ -46,6 +46,7 @@ with Sem_Res; use Sem_Res;
with Sem_Util; use Sem_Util;
with Sem_Warn; use Sem_Warn;
with Sinfo; use Sinfo;
+with Snames; use Snames;
with Stand; use Stand;
package body Sem_Ch11 is
@@ -417,9 +418,13 @@ package body Sem_Ch11 is
-- If the current scope is a subprogram, then this is the right place to
-- check for hanging useless assignments from the statement sequence of
- -- the subprogram body.
+ -- the subprogram body. Skip this in the body of a postcondition,
+ -- since in that case there are no source references, and we need to
+ -- preserve deferred references from the enclosing scope.
- if Is_Subprogram (Current_Scope) then
+ if Is_Subprogram (Current_Scope)
+ and then Chars (Current_Scope) /= Name_uPostconditions
+ then
Warn_On_Useless_Assignments (Current_Scope);
end if;
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 75c1f3bd8a0..d3003643f64 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -4711,20 +4711,22 @@ package body Sem_Ch13 is
Find_Overlaid_Entity (N, O_Ent, Off);
- -- Overlaying controlled objects is erroneous
+ -- Overlaying controlled objects is erroneous.
+ -- Emit warning but continue analysis because program is
+ -- itself legal, and back-end must see address clause.
if Present (O_Ent)
and then (Has_Controlled_Component (Etype (O_Ent))
or else Is_Controlled (Etype (O_Ent)))
+ and then not Inside_A_Generic
then
Error_Msg_N
- ("??cannot overlay with controlled object", Expr);
+ ("??cannot use overlays with controlled objects", Expr);
Error_Msg_N
("\??Program_Error will be raised at run time", Expr);
Insert_Action (Declaration_Node (U_Ent),
Make_Raise_Program_Error (Loc,
Reason => PE_Overlaid_Controlled_Object));
- return;
elsif Present (O_Ent)
and then Ekind (U_Ent) = E_Constant