comp.lang.ada
 help / color / mirror / Atom feed
From: dennison@romulus23.DAB.GE.COM (Ted Dennison)
Subject: Re: Posix.String_List question
Date: 5 Oct 1994 16:59:27 GMT
Date: 1994-10-05T16:59:27+00:00	[thread overview]
Message-ID: <36um1f$b65@theopolis.orl.mmc.com> (raw)
In-Reply-To: STEF.94Oct4234145@heron.cfmu.eurocontrol.be

In article <STEF.94Oct4234145@heron.cfmu.eurocontrol.be>, stef@heron.cfmu.eurocontrol.be (Stef Van Vlierberghe) writes:
|> 
|> I recently reported a "bug" (Alsys 5.5.2 on HP9000/700), but the actual
|> code is so aggressive that I'm not sure who really is to blame. I see a
|> choice of the appliction, the vendor, POSIX1003.5 definition, or Ada.
|> 
|> The relevant code is :
|> 
|>   BYPASS_COPY_BACK : exception;
|> 
|>   procedure TRY_BREAK_IT (  LIST : in out POSIX_STRING_LIST ) is
|>   begin
|>     MAKE_EMPTY(LIST);
|>     raise BYPASS_COPY_BACK;
|>     -- if LIST is by copy the caller won't see we emptied it
|>   end;
|> 
(rest of code deleted)
|> After quite a while this code gets the heap corrupted.
|> 
|> Evidently the relevant piece of LRM is 6.2(7) : The execution of a
|> program is erroneous if its effect depends on which mechanism is selected
|> by the implementation.
|> 

Also signifigant: LRM 6.2 (11-12):
"For parameters of array and record types, the parameter passing rules have
 these consequences:

  o  If the execution of a subprogram is abandoned as a result of an 
     exception, the final value of an acutal parameter of such a type can be
     either its value before the call or a value assigned to the formal 
     parameter during the execution of the subprogram."

Therefore this behavior is a bug in your code, NOT in the compiler.

To force a call by reference, simply pass TRY_BREAK_IT an object of type
"access POSIX_STRING_LIST". 

T.E.D.



      reply	other threads:[~1994-10-05 16:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-10-04 22:41 Posix.String_List question Stef Van Vlierberghe
1994-10-05 16:59 ` Ted Dennison [this message]
replies disabled

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