[Ada] Pair miscount in Dynamic_HTable.Put
authorHristian Kirtchev <kirtchev@adacore.com>
Wed, 26 Sep 2018 09:18:23 +0000 (09:18 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Wed, 26 Sep 2018 09:18:23 +0000 (09:18 +0000)
commit4f95defaa9c9e60f3e07f629bde8189fb6af19cf
tree5240b291614aa754bc7f6ef295f95a3c8258f4ab
parent3e4ade66c6749652de644017de696f9c1e60f3ae
[Ada] Pair miscount in Dynamic_HTable.Put

This patch corrects the logic of GNAT.Dynamic_HTables.Dynamic_HTable.Put to
update the number of key-value pairs in the hash table only when the put is
adding a new pair, rather than updating the value of an existing pair.

2018-09-26  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* libgnat/g-dynhta.adb (Prepend_Or_Replace): Update the number
of key-value pairs in the hash table only when adding a brand
new pair.

gcc/testsuite/

* gnat.dg/dynhash1.adb: New testcase.

From-SVN: r264623
gcc/ada/ChangeLog
gcc/ada/libgnat/g-dynhta.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/dynhash1.adb [new file with mode: 0644]