Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

array dimensioning

Intel_C_Intel
Employee
490 Views
In the following piece of code we tried four ways of dimensioning a simple integer-array. The first two methods (dimensioning by a common-block or a subroutine-argument) cause the error-message:

forrtl: severe (170): Program Exception - stack overflow

..., while the third and fourth way of declaring the bounds of the array work properly - all four ways allocate an array of the same size!
Is there an answer to this mystery??

Code (methods 2-4 not active)


 
program test 
implicit double precision (a-h,o-z) 
common /mtest/ msize 
msize = 259931 
isize = msize 
call subtest(isize) 
end 
 
subroutine subtest(i) 
implicit double precision (a-h,o-z) 
parameter (lsize = 259931) 
common /mtest/ msize 
 
! the following two lines fail during run-time: 
 dimension itestarray(i) 
! dimension itestarray(msize) 
 
! the following two lines don't fail during run-time: 
! dimension itestarray(lsize) 
! dimension itestarray(259931) 
end

0 Kudos
3 Replies
Steven_L_Intel1
Employee
490 Views
The third and fourth methods allocate the array at fixed addresses at link time, whereas the first and second are "automatic arrays" which get allocated on the stack at run-time.

Steve
0 Kudos
Intel_C_Intel
Employee
490 Views
Hi
I have the same problem. It seems that the only way to go around this problem is to expand the stack size. I tried with limit and it is not enough. How can I do this?

thanks

Giancarlo
0 Kudos
Steven_L_Intel1
Employee
490 Views
giancarlo,

What operating system are you using? You may want to consider using ALLOCATABLE arrays rather than automatic arrays.

Steve
0 Kudos
Reply