- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a matrix copy routine in a module as follows:
subroutine f_rmatrixCopy_1(fArr,tArr)
real(8), allocatable :: fArr(:), tArr(:)
tArr = fArr
end subroutine f_rmatrixCopy_1
When I call with
call f_rmatrixCopy_1(BVS,SAVBVS)
I get on the assignment line:
forrtl: severe(170): Program Exception - stack overflow
Both BVS and SAVBVS are allocated and are the same size (259081)
However when I replace the assignment with:
do i = 1, size(farr)
tArr(i) = fArr(i)
enddo
All works fine. Why doesn't the assignment work?
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unless you are doing the allocation in your f_rmatrixCopy_1 routine then you shouldn't need the allocatable attribute (as long as the arrays are already allocated)
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I removed the allocatable attributes, but I still get the stack overflow exception.
Adrian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you have heap arrays set to zero ? If not then set it to zero (Under Properties->Fortran->Optimization)
Under Linker->System do you have a stack reserve size set? If so what do you have?
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My stack was too small. But instead of increasing it, I'll use the second method as this won't run into the stack problem. Thanks.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page