aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnat/a-cihama.adb
diff options
context:
space:
mode:
authorRichard Wai <richard@annexi-strayline.com>2021-03-15 06:24:00 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2021-04-28 05:37:52 -0400
commit5b4b66291f2086f56dc3a1d7df494f901cd0b63e (patch)
tree91443a88a83b517dc2d0d808f76c79033c8b35f8 /gcc/ada/libgnat/a-cihama.adb
parentfccc47dddc2ee605dd7fce5c1d1711404e19cd7f (diff)
downloadgcc-5b4b66291f2086f56dc3a1d7df494f901cd0b63e.zip
gcc-5b4b66291f2086f56dc3a1d7df494f901cd0b63e.tar.gz
gcc-5b4b66291f2086f56dc3a1d7df494f901cd0b63e.tar.bz2
[Ada] Hashed container Cursor type predefined equality non-conformance
gcc/ada/ * libgnat/a-cohase.ads (Cursor): Synchronize comments for the Cursor type definition to be consistent with identical definitions in other container packages. Add additional comments regarding the importance of maintaining the "Position" component for predefined equality. * libgnat/a-cohama.ads (Cursor): Likewise. * libgnat/a-cihama.ads (Cursor): Likewise. * libgnat/a-cohase.adb (Find, Insert): Ensure that Cursor objects always have their "Position" component set to ensure predefined equality works as required. * libgnat/a-cohama.adb (Find, Insert): Likewise. * libgnat/a-cihama.adb (Find, Insert): Likewise. gcc/testsuite/ * gnat.dg/containers2.adb: New test.
Diffstat (limited to 'gcc/ada/libgnat/a-cihama.adb')
-rw-r--r--gcc/ada/libgnat/a-cihama.adb4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/ada/libgnat/a-cihama.adb b/gcc/ada/libgnat/a-cihama.adb
index 7a490d5..50adea1 100644
--- a/gcc/ada/libgnat/a-cihama.adb
+++ b/gcc/ada/libgnat/a-cihama.adb
@@ -522,7 +522,8 @@ is
return No_Element;
end if;
- return Cursor'(Container'Unrestricted_Access, Node, Hash_Type'Last);
+ return Cursor'
+ (Container'Unrestricted_Access, Node, HT_Ops.Index (HT, Node));
end Find;
--------------------
@@ -748,6 +749,7 @@ is
end if;
Position.Container := Container'Unchecked_Access;
+ Position.Position := HT_Ops.Index (HT, Position.Node);
end Insert;
procedure Insert