comp.lang.ada
 help / color / mirror / Atom feed
From: Vance Christiaanse <cintech@ix.netcom.com>
To: ullar@einstein.ph.utexas.edu
Subject: Re: Aggregate assignment problem with gnat under irix
Date: 1996/06/02
Date: 1996-06-02T05:45:09-07:00	[thread overview]
Message-ID: <31B15453.3911@ix.netcom.com> (raw)
In-Reply-To: Pine.SGI.3.93.960531171236.29298A-100000@einstein.ph.utexas.edu


Ullar Kask wrote:

> Hello,
> 
>   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.

[ ... code sample deleted ... ]
 
> Has the STORAGE_ERROR raised in the task body (under irix) something to do
> with the size of the task stack? How it happens that such an aggregate
> assignment is possible outside a task body but fails inside?
> 
> Any comments on the issue are appreciated!
> 
> Thanks a lot!
> 
> ================================================================================
> �llar Kask
> Center for Relativity, University of Texas, Austin
> email: ullar@einstein.ph.utexas.edu
> ph. (512) 471-5905
> http://wwwrel.ph.utexas.edu/Members/ullar/

Your task-stack-size theory is correct.  If I ran your code in the tasking
environment I am most familiar with (Verdix Ada on 680X0), it would behave as
you've described for the reason you suspect.

Heap memory is allocated in chunks starting from the low-address end of free
memory and the main procedure stack starts at the high-address end.  Each task
stack is allocated out of the heap with a fixed size.  (The default in the
Verdix environment is about 10 Kbytes.)  But the main-procedure stack size is
all of free memory minus whatever has been taken out of the heap.

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.)

It looks as though the default task stack size in your environment is not
large enough to allow 40+ Kbytes of temporary storage but your main procedure
stack is large enough.

Vance

Vance Christiaanse
Cintech Consulting
Syracuse, NY
cintech@ix.netcom.com




  parent reply	other threads:[~1996-06-02  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 ` David C. Hoos, Sr.
1996-06-02  0:00   ` Vance Christiaanse
1996-06-02  0:00 ` Vance Christiaanse [this message]
1996-06-03  0:00   ` Keith Thompson
replies disabled

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