I was having a stack overflow error in a fortran code compiled with fortran compiler 2013 and VS2010 under windows 7. I first try to set HeapArrays=0 in Project Properties ->Fortran -> Optimization -> Heap (Allocates temporary arrays of size n in the heap rather than in the stack). In that way all the arrays should move to the heap. However, nothing changed and the stack overflow error was still there. Then I added the flag /stack:2000000 in the Link Options and now everything runs smoothly. Why HeapArrays=0 does not work? I have a bunch of character*2650 declarations, both in the main code and in subroutines. Is it possible the declarations in the main code are not considered "temporary arrays" ? The stack overflow error shows up right at the beginning.
EDIT: this is my declaration in the main program. I have similar ones (but shorter ) in subroutines:
character*2560 DOScallINV,FORMdosCALLtxt,FORMdosCALLinv,filenam,FILEinv,provSTR,FMTtimeMETEO,&
TIMEstring,fmtGRID,fmtTIMEstring,FMTdataMETEO,WORKINGdir,path,DIRgribs,PATHgribs,&
DIRresultsRUN,PATHoutput,previousDIR,filePATH,PATHresultsRUN,PATHinputD3D,textFILE,&
newLINE,textFILE1,textFILE2,PATHlogs,LOGfile,LOGdir,ilineTXT,message,PATHresultsREST,&
LastRUNfolder,PATHobs,PATHopenda,PATHresultsRUNm1,workworkWITHnum,pathSTOBS,pathSTMOD,pathALG,&
toBEfound,COLLECTdirect,COLLECTdirectLOC,PATHwork,filePATHtot,filePATHlong,stringCAL,string,&
pathNM,filePATH_d3model,CDstring,toBEadded,stringCALini,filePATH_d3wrapper,fileWIND,dudFILE,stringL,stringU,fileWINDcal,&
PATHweb,pathREGR,fileWEB,PATHfileANALYSIS,threadFILE,threadFILEcopy