aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/a-coinve.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-11-04 15:00:29 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2011-11-04 15:00:29 +0100
commit4c9fe6c7494e31402c1c3ae4565aa03f70144258 (patch)
tree6faef4762f1e148699e2e63fb88c2fc56f034a7d /gcc/ada/a-coinve.adb
parent6ec084f3873a3216c212713722d75084ca146eff (diff)
downloadgcc-4c9fe6c7494e31402c1c3ae4565aa03f70144258.zip
gcc-4c9fe6c7494e31402c1c3ae4565aa03f70144258.tar.gz
gcc-4c9fe6c7494e31402c1c3ae4565aa03f70144258.tar.bz2
[multiple changes]
2011-11-04 Robert Dewar <dewar@adacore.com> * gnat_rm.texi: Minor reformatting. 2011-11-04 Matthew Heaney <heaney@adacore.com> * a-convec.adb, a-coinve.adb, a-cobove.adb (Merge): Raise PE when Target and Source denote same non-empty object * a-cdlili.adb, a-cidlli.adb, a-cbdlli.adb (Merge): Ditto 2011-11-04 Robert Dewar <dewar@adacore.com> * exp_attr.adb: Minor reformatting. 2011-11-04 Ed Schonberg <schonberg@adacore.com> * exp_ch5.adb (Expand_Assign_Record): Do not generate a discriminant assignment within an initialization proc if the record is an unchecked union, as it can only come from the initialization of an unchecked union component. 2011-11-04 Robert Dewar <dewar@adacore.com> * gnat_ugn.texi: Minor reformatting. 2011-11-04 Robert Dewar <dewar@adacore.com> * par-labl.adb (Rewrite_As_Loop): Generate info msg rather than warning message. 2011-11-04 Robert Dewar <dewar@adacore.com> * exp_ch4.adb: Minor code reorganization (remove junk obsolete var Save_Space). From-SVN: r180954
Diffstat (limited to 'gcc/ada/a-coinve.adb')
-rw-r--r--gcc/ada/a-coinve.adb18
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/ada/a-coinve.adb b/gcc/ada/a-coinve.adb
index ae72e65..e35f2f7 100644
--- a/gcc/ada/a-coinve.adb
+++ b/gcc/ada/a-coinve.adb
@@ -1268,16 +1268,26 @@ package body Ada.Containers.Indefinite_Vectors is
I, J : Index_Type'Base;
begin
- if Target.Last < Index_Type'First then
- Move (Target => Target, Source => Source);
+
+ -- The semantics of Merge changed slightly per AI05-0021. It was
+ -- originally the case that if Target and Source denoted the same
+ -- container object, then the GNAT implementation of Merge did
+ -- nothing. However, it was argued that RM05 did not precisely
+ -- specify the semantics for this corner case. The decision of the
+ -- ARG was that if Target and Source denote the same non-empty
+ -- container object, then Program_Error is raised.
+
+ if Source.Last < Index_Type'First then -- Source is empty
return;
end if;
if Target'Address = Source'Address then
- return;
+ raise Program_Error with
+ "Target and Source denote same non-empty container";
end if;
- if Source.Last < Index_Type'First then
+ if Target.Last < Index_Type'First then -- Target is empty
+ Move (Target => Target, Source => Source);
return;
end if;