Re: Stack overflow problem but increasing stack size does not solve the problem



nure123@xxxxxxxxx wrote:
On Jan 26, 1:43 am, Ravindra Vidhate <ravividh...@xxxxxxxxx> 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

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
.



Relevant Pages

  • Re: Segmentation Fault without write?
    ... I've written a subroutine and when I finished it I ... Look in your documentation, find out which flag enables array bounds checking, ... should be your out of bounds reference. ... double precision webx ...
    (comp.lang.fortran)
  • Re: Call Array valued Fortran function from C
    ... documentation about gfortran array descriptors for you. ... double precision, dimension:: array ... type, bind:: descr ... integerunknown1 ...
    (comp.lang.fortran)
  • Re: SNGL intrinsic question
    ... You have initialized an array of double- ... precision numbers with single-precision literals. ... The compiler bug ...
    (comp.lang.fortran)
  • Re: What is wrong with this code?
    ... Uh, yeah, for me on this compiler, just a warning, I think. ... ridiculous contortions to avoid using a pointer to an ARRAY. ... The use of a global struct is another unnecessary design flaw. ... the extra precision. ...
    (comp.lang.c)
  • Re: Fast integer distance formula
    ... array of signed 16-bit numbers, but x and y themselves are 32-bit numbers in the ... stored back into an array of 16-bit integers, since the distance formula can ... It is likely more accurate than you need, but I think you can simply truncate the algorithm sooner for less precision. ...
    (comp.dsp)