random function produce a address error

random function produce a address error

Hi,
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:
IMPLICIT NONE
INTEGER(4) lc, l
REAL(4), ALLOCATABLE, DIMENSION (:) :: xc, yc, syc
REAL(4), DIMENSION (10) :: PAR_CUR
REAL(4) :: A, B, C
EXTERNAL xtrack, paralin, curvcorr
real(4) :: rand
a=0.
b=0.
c=0.
lc=0
l=0
write(*,*) rand()
.
.
.
END PROGRAM spectrum_gen

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

Martino

2 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

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.

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen