From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ab0baaaa4d794769 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread2.news.atl.earthlink.net.POSTED!14bb18d8!not-for-mail Sender: mheaney@MHEANEYX200 Newsgroups: comp.lang.ada Subject: Re: Ada.Containers.Indefinite_Ordered_Maps of gcc 4.0.1 has bug ? References: <42F4B753.2080004@panathenaia.halfmoon.jp> From: Matthew Heaney Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 06 Aug 2005 15:37:35 GMT NNTP-Posting-Host: 24.149.57.125 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.atl.earthlink.net 1123342655 24.149.57.125 (Sat, 06 Aug 2005 08:37:35 PDT) NNTP-Posting-Date: Sat, 06 Aug 2005 08:37:35 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news1.google.com comp.lang.ada:4005 Date: 2005-08-06T15:37:35+00:00 List-Id: "Y.Tomino" writes: > I send a-ciorma.ad? as attachments. > (C:\mingw\lib\gcc\i686-pc-mingw32\4.0.1\adainclude\a-ciorma.ads, > C:\mingw\lib\gcc\i686-pc-mingw32\4.0.1\adainclude\a-ciorma.adb) > > I built gcc 4.0.1 with "--enable-languages=c,ada,c++ --prefix=/mingw". You appear to have an older version of the sources. Here's the problem: function Copy_Node (Source : Node_Access) return Node_Access is Target : constant Node_Access := new Node_Type'(Parent => null, Left => null, Right => null, Color => Source.Color, Key => Source.Key, Element => Source.Element); begin return Target; end Copy_Node; In this implementation of the indefinite container, keys and elements are allocated. The code fragment above simply copies the pointers, but this is wrong, since Adjust must make its own copy. This is an old bug, that was fixed a few months ago. I'm surprised you're seeing it. You can simply patch your copy like this: function Copy_Node (Source : Node_Access) return Node_Access is K : Key_Access := new Key_Type'(Source.Key.all); E : Element_Access; begin E := new Element_Type'(Source.Element.all); return new Node_Type'(Parent => null, Left => null, Right => null, Color => Source.Color, Key => K, Element => E); exception when others => Free_Key (K); Free_Element (E); raise; end Copy_Node; Alternatively you can grab a copy of that module from the repository at . I would submit a bug report either to the FSF or to AdaCore, to ensure the fix wends its way to public GCC repositories. This bug was found and fixed in AdaCore's sources a while ago, so I don't understand why you don't have the latest, corrected version. -Matt