Software Archive
Read-only legacy content
17060 Discussions

stack overflow

Intel_C_Intel
Employee
882 Views
Everyone,

I got stack overflow error. It is on subroutine entry. How to expand the size of stack?

Thank
0 Kudos
4 Replies
Intel_C_Intel
Employee
882 Views
This is not a reply to your question. Just some additional observations. I have encountered the error that you are talking about several times. It was always happening when I was passing faily big sized arrays as the arguments to a subroutine. The thing that puzzles me is that I was always under the impression that all the arguments are passed by reference in fortran (by default). So, when you are passing an array to a subroutine, only one address pointer must have been passed around which could not possibly overflow the stack. So, what is the reason for overflowing the stack.

Ali Asi
asi@enginia.com
0 Kudos
Intel_C_Intel
Employee
882 Views
You probably have an array temporary created on subroutine entry due to the way you're making the call. You can increase the size of the stack, but a larger array may one day exceed that too. Or you can change the way you make the call and avoid the creation of the array temporary. I'd choose the latter.

hth,
JT

Links:
In the online docs
Setting the stack size with the /stack linker switch

Changing the stack size with the editbin tool

Passing arrays:
Newsletter 1, Chris Bord's article 'PASSING ARRAYS IN FORTRAN 90'

In the online docs, under Programmer's Guide | Performance: Making Programs Run Faster | Use Arrays Efficiently | Passing Array Arguments Efficiently
0 Kudos
Intel_C_Intel
Employee
882 Views
Thank a lot,

I almost use allocatable and pointer in my routine, and deallocate when it not used.

With same problem, stack overflow does not occur if I compiled with LF95. It means stack size of CVF too small?
0 Kudos
Intel_C_Intel
Employee
882 Views
Toppo,

If you'd like a specific diagnosis of the problem, you should probably post the version of CVF you're using, and enough code to let someone point out anything that may help (this should include the subroutine declaration and the declaration of all dummy variables, local variables, and the actual args passed in.)

-JT
0 Kudos
Reply