comp.lang.ada
 help / color / mirror / Atom feed
From: firth@sei.cmu.edu (Robert Firth)
Subject: Re: A Bug in VAX Ada (ACCVIO)
Date: 12 Jan 88 19:41:28 GMT	[thread overview]
Message-ID: <3777@aw.sei.cmu.edu> (raw)
In-Reply-To: 596@cernvax.UUCP

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)

  reply	other threads:[~1988-01-12 19:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1988-01-08 20:30 A Bug in VAX Ada (ACCVIO) Spencer Peterson
1988-01-11  9:01 ` paul
1988-01-12 19:41   ` Robert Firth [this message]
     [not found] <1@<1988>
1988-01-14 16:51 ` ron
1988-01-18 13:34   ` Robert Firth
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox