------- Comment #8 from laurent at guerby dot net 2007-06-07 19:43 ------- Here is a test case that's likely to fail: I just allocate a non zero filled record of the right size before filling the map.
Expects no output, but will raise program_error because of the bug (with 4.3.0 20070606 on x86_64-linux). $ gnatmake -g p; ./p gcc -c -g p.adb gnatbind -x p.ali gnatlink p.ali -g raised PROGRAM_ERROR : p.adb:27 explicit raise $ cat p.adb with Ada.Unchecked_Deallocation; 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; type R is record X,Y,Z : Integer := 5; end record; type R_Ptr is access R; RR : R_Ptr := new R; procedure Free is new Ada.Unchecked_Deallocation (R, R_Ptr); package M is new Ada.Containers.Hashed_Maps (Integer, Item_Pointer, H, "="); Z : M.Map; Position : M.Cursor; Inserted : Boolean; Item : Item_Pointer; begin Free (RR); M.Insert (Z, 2, Position, Inserted); -- default initialization for new item Item := M.Element (Position); if Item /= null then -- Item contains a random value here raise Program_Error; end if; end; -- laurent at guerby dot net changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |laurent at guerby dot net Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |wrong-code Last reconfirmed|0000-00-00 00:00:00 |2007-06-07 19:43:14 date| | Summary|Default pointer |[Ada] Default pointer |initialization not occuring |initialization not occuring |- due to the use of <> |- due to the use of <> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32234