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,a88e582de42cdc9b X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Bug in Ada (SuSe 10.2) ? From: Georg Bauhaus In-Reply-To: <69019a65-736e-48ee-bd9f-4c29cd7fc88f@72g2000hsu.googlegroups.com> References: <0_mdna0iHpIsCifaRVnzvQA@telenor.com> <47ba9867$0$21892$4f793bc4@news.tdc.fi> <3a281192-2744-4110-9fc1-90c155c9436b@d4g2000prg.googlegroups.com> <48277611-402f-4622-be05-6edddf6dd56a@o10g2000hsf.googlegroups.com> <624tcvF21i3nvU1@mid.individual.net> <2630d99b-1578-4d79-ac9c-64c00c203b77@e60g2000hsh.googlegroups.com> <69019a65-736e-48ee-bd9f-4c29cd7fc88f@72g2000hsu.googlegroups.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1203708110.6651.7.camel@K72> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Date: Fri, 22 Feb 2008 20:21:50 +0100 Organization: Arcor NNTP-Posting-Date: 22 Feb 2008 20:21:50 CET NNTP-Posting-Host: cb9f1200.newsspool1.arcor-online.net X-Trace: DXC=Jb`TGS:Ee`\HigV@eW57PQic==]BZ:af^4Fo<]lROoRQFl8W>\BH3YR91Neg@6Y0LSA:ho7QcPOVSA]kYR;4NCoZbF31Ea_J>nT X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:19985 Date: 2008-02-22T20:21:50+01:00 List-Id: On Fri, 2008-02-22 at 08:10 -0800, billjones6789@yahoo.com wrote: > Of course, the danger is only eliminated when this language-defined > check is fully implemented in standard mode. Here is another dangling pointer. The program is giving me results varying with compiler/OS. I didn't see how accessiblity checks could help in this case, but then maybe this is a different issue? with Ada.Unchecked_Deallocation; with Ada.Text_IO; procedure News3 is use Ada; type Int_Ptr is access Integer; Pointer: Int_Ptr; Dangling_Pointer: Int_Ptr; procedure Copy(Source: in out Int_Ptr; Target: out Int_Ptr) is procedure Oops is new Unchecked_Deallocation (Integer, Int_Ptr); begin Target := Source; Oops(Source); end Copy; begin Pointer := new Integer'(42); Copy(Pointer, Dangling_Pointer); Text_IO.Put_Line(Integer'image(Dangling_Pointer.all)); end News3;