Home > Archive > Fortran > January 2008 > Re: Stack overflow problem but increasing stack size does not solve
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: Stack overflow problem but increasing stack size does not solve
|
|
| nure123@gmail.com 2008-01-26, 4:29 am |
| On Jan 26, 1:43 am, Ravindra Vidhate <ravividh...@gmail.com> wrote:
> As the your code shows that it is a recursive function so there must
> exists a condition to break this recursiveness.
>
> Ravindra
Sorry, I pasted the wrong version. Problem exists with the following
code too.
file1:
PROGRAM MAIN
DOUBLE PRECISION a(65,2001)
CALL ROUTINE1(a)
END PROGRAM
file2:
SUBROUTINE ROUTINE1(a)
DOUBLE PRECISION a(65,2001)
RETURN
END SUBROUTINE
| |
| Louis Krupp 2008-01-26, 4:29 am |
| nure123@gmail.com wrote:
> On Jan 26, 1:43 am, Ravindra Vidhate <ravividh...@gmail.com> wrote:
>
> Sorry, I pasted the wrong version. Problem exists with the following
> code too.
>
> file1:
> PROGRAM MAIN
> DOUBLE PRECISION a(65,2001)
> CALL ROUTINE1(a)
> END PROGRAM
>
> file2:
> SUBROUTINE ROUTINE1(a)
> DOUBLE PRECISION a(65,2001)
> RETURN
> END SUBROUTINE
You might try adding "SAVE" to the array declaration in your main program:
SAVE DOUBLE PRECISION a(65,2001)
This might get the array off the stack at the expense of making your
code file bigger.
Dynamically allocating the array might be even better; see your Fortran
manual for details.
(Others here will know more about these options, but depending on what
time zone you're in, this might be useful for now.)
Louis
| |
| Louis Krupp 2008-01-26, 10:30 pm |
| Richard Maine wrote:
> Louis Krupp <lkrupp@pssw.nospam.com.invalid> wrote:
>
>
> Two things.
>
> 1. SAVE in a main program has no effect according to the standard. Of
> course, the matter of stack versus other storage implementation is
> outside of the scope of the standard and it is possible that a compiler
> might change that depending on SAVE.
>
> 2. This syntax won't work in any case.
>
>
Quite right, of course.
In the unlikely event that the OP is still interested, this *might* work:
DOUBLE PRECISION a(65,2001)
SAVE a
Louis
|
|
|
|
|