Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A weird problem

Status
Not open for further replies.

JEichhorn

Programmer
Oct 21, 2014
10
DE
This is a tricky one: I have to maintain 2 versions of an F90 code consisting of ~11000 lines. The only difference between those versions is as follows:

Main program of version A contains an IF block which checks existence or non-existence of a certain file, opens the file, reads it and checks its conten and finally closes the file again. Something like this:
Code:
ex = .false.
INQUIRE (file = installdir(1:length)//'some_file',exist=ex)
IF (.NOT.ex) THEN
   PRINT*,' ERROR 1007: some_file missing'
ELSE
   OPEN (33,FILE=installdir(1:length)//'some_file',STATUS='old',ACTION='read')
   READ (33,'(A)') TestString
   CLOSE (33)
   IF (TestString .NE. 'teststring') THEN
      PRINT*,' ERROR 1008: some_file invalid'
   ENDIF                
ENDIF

Now to the weird problem: Version B which does _NOT_ include the above statements crashes in a subroutine where arrays are allocated, some allocate statements return istat/=0. The above code has NOTHING to do with the array, in fact it has NOTHING to do with the remainder of the code at all.

Any help would be greatly appreciated.
 
Hhhhmmm...sounds like some memory mishandling problem...when seemingly un-related issue like this one appears, it often indicates a memory mishandling, memory allocation problem...it is just that the extra code moves things around in memory so that the program behaves differently.

...you may want to compile for debugging and add some other compilation flags to look for memory leakage issues (array bounds, etc) and see what happens

...but sounds like you do have a real problem at hand
 
Solved!

Compiling options were not identical for both versions. The one that crashed used twice as much stack space as the one that didn't. The domain size together with the stack was too large for the 32bit environment applied.

Two more reasons for (a) the 64bit environment and (b) the Linux version of my code which fetches just as much stack space as needed ....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top