------- Comment #10 from anhvofrcaus at gmail dot com 2007-06-08 01:10 ------- Thank you both for your explanation to a newbie having no experience with valgrind tool. I have come up with a simpler version which similar to Laurent's. Here it goes.
with Ada.Containers.Hashed_Maps; procedure P is function H (I : Integer) return Ada.Containers.Hash_Type is begin return Ada.Containers.Hash_Type'Mod (I); end; type Item_Pointer is access Boolean; package M is new Ada.Containers.Hashed_Maps (Integer, Item_Pointer, H, "="); Z : M.Map; Position : M.Cursor; Inserted : Boolean; Item : Item_Pointer; begin M.Insert (Z, 2, Position, Inserted); -- default initialization for new item Item := M.Element (Position); if not Item.all'Valid then -- equivalent to Item /= null if check raise Program_Error with "Failing test"; end if; end P; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32234