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=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!water!watmath!clyde!rutgers!rochester!PT.CS.CMU.EDU!sei!sei.cmu.edu!firth From: firth@sei.cmu.edu (Robert Firth) Newsgroups: comp.lang.ada Subject: Re: A Bug in VAX Ada (ACCVIO) Message-ID: <3777@aw.sei.cmu.edu> Date: 12 Jan 88 19:41:28 GMT References: <1988.1.8.20.3.20.Alfred.Peterson@sei.cmu.edu> <596@cernvax.UUCP> Sender: netnews@sei.cmu.edu Reply-To: firth@bd.sei.cmu.edu.UUCP (Robert Firth) Organization: Carnegie-Mellon University, SEI, Pgh, Pa List-Id: In article <596@cernvax.UUCP> paul@cernvax.UUCP () writes: >Seems odd to me that it should be legal to optimise an otherwise good >program (in my opinion) into one that doesn't work any more. > >Does anyone else think the program is erroneous? > >Paul Just to refresh your memory, here is the program: ======== A bug in Vax Ada compiler ? --------------------------- just have a look at that short procedure: with UNCHECKED_DEALLOCATION; with TEXT_IO; procedure G_ADA_BUG is type ACCESS_STRING is access STRING; procedure DISPOSE is new UNCHECKED_DEALLOCATION (STRING, ACCESS_STRING); A: ACCESS_STRING := new STRING'("Ceci est un exemple..."); B: constant STRING := A.all; begin -- G_ADA_BUG TEXT_IO.PUT_LINE (A.all); TEXT_IO.PUT_LINE (B); DISPOSE (A); TEXT_IO.PUT_LINE (B); end G_ADA_BUG; I have compiled (with default options) it with Vax Ada V1.4-33 running under Vax/Vms V4.5 on a Vax-8600. The expected result is: Ceci est un exemple... Ceci est un exemple... Ceci est un exemple... But I got it: Ceci est un exemple... Ceci est un exemple... %SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=7FF3EA00, PC=00013FF3, PSL=0BC00000 %TRACE-F-TRACEBACK, symbolic stack dump follows ... ======== In my opinion, the program is not erroneous and the compiler is buggy. There is no aliasing in the source code. The line B : constant STRING := A.all specifically requests a copy of the string from the object designated by A into the local constant object B. For the compiler to share the actual string is illegitimate. (In general, it is not a correct program transformation to alias two objects of different and overlapping extent)