Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

random function produce a address error

marlinux
Beginner
398 Views

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

 

0 Kudos
1 Reply
TimP
Honored Contributor III
398 Views
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.
0 Kudos
Reply