comp.lang.ada
 help / color / mirror / Atom feed
From: kst@thomsoft.com (Keith Thompson)
Subject: Re: Aggregate assignment problem with gnat under irix
Date: 1996/06/03
Date: 1996-06-03T00:00:00+00:00	[thread overview]
Message-ID: <DsG0q3.7v1@thomsoft.com> (raw)
In-Reply-To: 31B15453.3911@ix.netcom.com


In <31B15453.3911@ix.netcom.com> Vance Christiaanse <cintech@ix.netcom.com> writes:
> Ullar Kask wrote:
> >   I am doing numerical simulations using Ada and encoutered a problem with
> > aggregate assignment. The same type of statement, viz.,
> > 
> >   A.all := (others => (others => 0.0));
> > 
> > where A.all is an NxN array (declared as unconstrained), works great
> > in simple procedures but fails in a task body. I don't understand
> > what may be the reason.
[...]
> Your array contains 40,401 reals (plus dope information).  An aggregate
> assignment requires that much stack space (temporarily) so the entire
> aggregate can first be built in a scratch area before the actual assignment
> to the destination is made.  (That way, if an exception occurs during
> evaluation of the aggregate, the destination won't be left in a partially-
> updated state.)

Note that, in this particular case, evaluation of the aggregate cannot
raise an exception, so the temporary scratch area is not strictly
necessary.  The compiler could generate code to build the aggregate value
directly in the target of the assignment, after first doing a few required
checks (A /= null, for example).  Apparently GNAT does not (yet?) perform
this optimization -- not surprising, since the GNAT folks are still
concentrating on implementing the language and generating correct code.

-- 
Keith Thompson (The_Other_Keith) kst@thomsoft.com <*>
TeleSoft^H^H^H^H^H^H^H^H Alsys^H^H^H^H^H Thomson Software Products
10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2718
This sig uses the word "Exon" in violation of the Communications Decency Act.




  reply	other threads:[~1996-06-03  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-05-31  0:00 Aggregate assignment problem with gnat under irix Ullar Kask
1996-06-02  0:00 ` Vance Christiaanse
1996-06-03  0:00   ` Keith Thompson [this message]
1996-06-02  0:00 ` David C. Hoos, Sr.
1996-06-02  0:00   ` Vance Christiaanse
replies disabled

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