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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bd1a17edc1ccb2d6 X-Google-Attributes: gid103376,public From: kst@thomsoft.com (Keith Thompson) Subject: Re: Aggregate assignment problem with gnat under irix Date: 1996/06/03 Message-ID: #1/1 X-Deja-AN: 158303193 sender: news@thomsoft.com (USENET News Admin @flash) x-nntp-posting-host: pulsar references: <31B15453.3911@ix.netcom.com> organization: Thomson Software Products, San Diego, CA, USA newsgroups: comp.lang.ada originator: kst@pulsar Date: 1996-06-03T00:00:00+00:00 List-Id: In <31B15453.3911@ix.netcom.com> Vance Christiaanse 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.