summaryrefslogtreecommitdiff
path: root/gcc/ada/a-coinve.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-20 12:13:11 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-20 12:13:11 +0000
commit5921a31bc9345a5d5193e31bae896058681d07f7 (patch)
treebc993cacd1970a808c9c3609d9348661e2e735c4 /gcc/ada/a-coinve.adb
parent9d11997b4dbd5e2db48d4caf45e75141a49fe7c8 (diff)
downloadgcc-5921a31bc9345a5d5193e31bae896058681d07f7.tar.gz
2015-10-20 Tristan Gingold <gingold@adacore.com>
* sem_util.adb (Is_Protected_Self_Reference): Remove reference to UET_Address in comment. * sem_attr.adb (Check_Unit_Name): Adjust comment. (Analyze_Attribute): Remove handling of UET_Address. * sem_attr.ads (Attribute_Impl_Def): Remove Attribute_UET_Address. * snames.ads-tmpl Remove Name_UET_Address, Attribute_UET_Address. * exp_attr.adb (Expand_N_Attribute_Reference): Remove Attribute_UET_Address. 2015-10-20 Bob Duff <duff@adacore.com> * a-cbdlli.adb, a-cdlili.adb, a-chtgop.adb, a-cidlli.adb, * a-cobove.adb, a-coinve.adb, a-convec.adb, a-crbtgo.adb ("="): Avoid modifying the tampering counts unnecessarily. (Adjust): Zero tampering counts unconditionally. 2015-10-20 Jerome Lambourg <lambourg@adacore.com> * init.c: Fix build issue on arm-vx6 when building the RTP run-time. 2015-10-20 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Analyze_Object_Declaration): If the expression is an aggregate and compilation is in -gnatI mode (ignore rep clauses) do not delay resolution of aggregate, to prevent freeze actions out of order in the backend. 2015-10-20 Ed Schonberg <schonberg@adacore.com> * sem_prag.ads, sem_prag.adb (Build_Generic_Class_Condition): New procedure to construct a generic function for a class-wide precondition, to implement AI12-0113 concerning the new semantics of class-wide preconditions for overriding uperations. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229060 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-coinve.adb')
-rw-r--r--gcc/ada/a-coinve.adb46
1 files changed, 29 insertions, 17 deletions
diff --git a/gcc/ada/a-coinve.adb b/gcc/ada/a-coinve.adb
index 106178a02bf..0053de0f442 100644
--- a/gcc/ada/a-coinve.adb
+++ b/gcc/ada/a-coinve.adb
@@ -103,29 +103,36 @@ package body Ada.Containers.Indefinite_Vectors is
---------
overriding function "=" (Left, Right : Vector) return Boolean is
- -- Per AI05-0022, the container implementation is required to detect
- -- element tampering by a generic actual subprogram.
-
- Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
- Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
begin
if Left.Last /= Right.Last then
return False;
end if;
- for J in Index_Type range Index_Type'First .. Left.Last loop
- if Left.Elements.EA (J) = null then
- if Right.Elements.EA (J) /= null then
- return False;
- end if;
+ if Left.Length = 0 then
+ return True;
+ end if;
- elsif Right.Elements.EA (J) = null then
- return False;
+ declare
+ -- Per AI05-0022, the container implementation is required to detect
+ -- element tampering by a generic actual subprogram.
- elsif Left.Elements.EA (J).all /= Right.Elements.EA (J).all then
- return False;
- end if;
- end loop;
+ Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
+ Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
+ begin
+ for J in Index_Type range Index_Type'First .. Left.Last loop
+ if Left.Elements.EA (J) = null then
+ if Right.Elements.EA (J) /= null then
+ return False;
+ end if;
+
+ elsif Right.Elements.EA (J) = null then
+ return False;
+
+ elsif Left.Elements.EA (J).all /= Right.Elements.EA (J).all then
+ return False;
+ end if;
+ end loop;
+ end;
return True;
end "=";
@@ -136,6 +143,12 @@ package body Ada.Containers.Indefinite_Vectors is
procedure Adjust (Container : in out Vector) is
begin
+ -- If the counts are nonzero, execution is technically erroneous, but
+ -- it seems friendly to allow things like concurrent "=" on shared
+ -- constants.
+
+ Zero_Counts (Container.TC);
+
if Container.Last = No_Index then
Container.Elements := null;
return;
@@ -149,7 +162,6 @@ package body Ada.Containers.Indefinite_Vectors is
begin
Container.Elements := null;
Container.Last := No_Index;
- Zero_Counts (Container.TC);
Container.Elements := new Elements_Type (L);