random function produce a address error

random function produce a address error

I am usin ifc 7.1 in a pentium III machine with redhat 9.0 (with a pach to the glibc library).
I have a program which is using the rand function.
I am compiling some .f and .f90 fortran files with the options: -g -C -d2 -Vaxlib

I have not errors in the compilation but when I execute the program I have the following error correspondig to the line test with the rand() function. The message

** Address Error **

Diagnostics Entered From MAIN PROGRAM Line 15
a = 0.000000E+00
b = 0.000000E+00
c = 0.000000E+00
l = 0
lc = 0

End of diagnostics

the program file is:

PROGRAM spectrum_gen
! Automatic Time-stamp:
INTEGER(4) lc, l
REAL(4), ALLOCATABLE, DIMENSION (:) :: xc, yc, syc
REAL(4) :: A, B, C
EXTERNAL xtrack, paralin, curvcorr
real(4) :: rand
write(*,*) rand()
END PROGRAM spectrum_gen

Do you have any suggestion?
In an other compiler (xlf) I have no problem.


2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Apparently, the optional argument feature works only when rand() is declared with an interface block, in accordance with the documentation. Remember that rand() is not a standard Fortran function, and is implemented differently among those compilers which include library support for it.

It's been a long time since I've seen xlf documentation, but my impression is that xlf would call the C version of the function directly, so your code could be broken in a different manner for xlf.

Leave a Comment

Please sign in to add a comment. Not a member? Join today