This patch fixes a bug in which a call such as Some_Map.Replace(10, Some_Map(5)) fails a tampering check. This happens with the Some_Map(5) notation, or with the equivalent explicit call to Constant_Reference. A call to Some_Map.Delete(10, Some_Map(5)) fails in the same way. Other children of Ada.Containers are affected in the same way.
Running these commands: gnatmake -q -f -g -O0 -gnata test_vectors.adb test_vectors On the following sources: with Ada.Containers.Vectors; procedure Test_Vectors is package My_Vectors is new Ada.Containers.Vectors (Positive, Float); use My_Vectors; My_Vector : Vector := To_Vector (10.123, 20); begin My_Vector.Replace_Element(10, My_Vector(5)); end Test_Vectors; Should execute silently. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-10-10 Bob Duff <d...@adacore.com> gcc/ada/ * libgnat/a-cbdlli.adb, libgnat/a-cbhama.adb, libgnat/a-cbhase.adb, libgnat/a-cbmutr.adb, libgnat/a-cborma.adb, libgnat/a-cborse.adb, libgnat/a-cdlili.adb, libgnat/a-cidlli.adb, libgnat/a-cihama.adb, libgnat/a-cihase.adb, libgnat/a-cimutr.adb, libgnat/a-ciorma.adb, libgnat/a-ciorse.adb, libgnat/a-cobove.adb, libgnat/a-cohama.adb, libgnat/a-cohase.adb, libgnat/a-coinve.adb, libgnat/a-comutr.adb, libgnat/a-conhel.adb, libgnat/a-convec.adb, libgnat/a-coorma.adb, libgnat/a-coorse.adb (Reference, Constant_Reference): Use Busy instead of Lock, so we forbid tampering with cursors, rather than tampering with elements.
patch.diff.gz
Description: application/gzip