This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/32234] [Ada] Default pointer initialization not occuring - due to the use of <>
- From: "anhvofrcaus at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Jun 2007 01:10:12 -0000
- Subject: [Bug ada/32234] [Ada] Default pointer initialization not occuring - due to the use of <>
- References: <bug-32234-13647@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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