Subject: Pointers in FORTRAN under IRIX

From: <[email-masked]>
Date: Thu, 13 Oct 1994 00:21:46 -0500 (CDT)

Hi Netters,

   Does anyone have any experience with pointers in FORTRAN working under
Silicon Graphics' IRIX ?  I have written FORTRAN code making use of a
very large (~20M in the latest example) 3-dim dense array of real*8.
Older version recalculates parts of it in every cycle; and in order to
speed it up I tried to calculate the array at the beginning and store it
in RAM throughout the program execution. Practical applications involve
problems of varying size, therefore, the conventional static storage
would have to waste a lot of memory. 
In newer version I associate a pointer with the array (IRIX implementation
has that feature) and reserve space with (also non-standard) malloc()
function. The program is fast and works OK with only one exception:
sometimes (90% of cases) it is killed with SIGSEGV (segmentation fault)
when an attempt of any disk output operation is made (mostly OPEN 
statement). After a week of debugging I have found no errors in algorithm.
Using very simple input I swepped, byte by byte, all 32 bytes of allocated
memory after executing every line of program to no avail.
The dbx with core-file points to line containig first disk output operation
(OPEN or WRITE) and the following subroutines:
malloc_, malloc__, realfree.
BTW, no output file is created.
The funny thing is that the program that cannot swallow 32-byte allocation,
works perfectly with a ~5M one. Seriously, I suspect a bug in the compiler.

Does anyone have similar experience ? Comments ?
Thank you very much for sharing your thoughts.

Robert Fraczkiewicz
Department of Chemistry
University of Houston
[email-masked]

Disclaimer: A flame/holy war of C vs FORTRAN is not intended...