Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28538 Discussions

Array Constructor Stack Overflow Problem

rmj
Beginner
700 Views
The below (simplified version of a larger) code runs fine for npts_all=60000 (or less) on my NT machine but it gives a stack error for npts_all=70000 (or more).
This error occurs only for the array constructor part.
Is there some compiler option that needs to be set for
this? I am using Compaq Visual Fortran. I looked in
manual but could find nothing that needed to be set for
array constructors explicitly.

One solution to my problem would be to remove all array constructors from my code and replace them with Do loops. I would rather not do this of course.

Any help would be much appreciated.
Thanks!

-Roger Jones
-----------------------
rmj@slac.stanford.edu
-----------------------

double precision, allocatable:: freq_all(:)
integer npts_all
read *,npts_all
allocate(freq_all(npts_all))
do 2222 kk=1,npts_all
freq_all(kk)=0.d0
2222 continue
pause
c
C Array Constructor below does not work for npts larger than
c approx 65,000 (70,000 does not work)
C But the DO loop above always works!
C
freq_all=(/(0.d0,kk=1,npts_all)/)
pause
stop
end
0 Kudos
2 Replies
Steven_L_Intel1
Employee
700 Views
There's nothing specific for array constructors. See the documentation index under "Stack, linker option setting size of".

Steve
0 Kudos
durisinm
Novice
700 Views
Once the freq_all array is allocated, can't it be initialized with freq_all=0.d0?

Mike
0 Kudos
Reply