Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29254 Discussions

rand() cause forrtl: severe (174): SIGSEGV, segmentation fault occurred

xingzhi
Beginner
574 Views
Hi all. I met an error seems come with the function of rand().
I'm using the Intel.Fortran.Compiler.8.1.021 (non commercial version) on a redhat linux enterprise v3.
Here is a simple test done in my computer. I just cannot understand what happening with this simple program. It runs good with my Compaq Fortran Compiler in Windows.
Please help and thanks in advance.
Regards,
Xingzhi
$ cat test.f
program testttt
integer Ns
parameter (Ns=16)
C
integer i
double precision htx
C
Do i=1,Ns
htx=rand()
print *, i,htx
End Do
C
End program
$ifort test.f
$./a.out
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
a.out 0804A3C0 Unknown Unknown Unknown
a.out 0804A228 Unknown Unknown Unknown
Unknown 4024179D Unknown Unknown Unknown
a.out 0804A0E1 Unknown Unknown Unknown
0 Kudos
2 Replies
TimP
Honored Contributor III
574 Views
As the for_lib.pdf shows, add
use ifport
0 Kudos
xingzhi
Beginner
574 Views
Thank you tim18,
Actually, I added a comma in the (), namely "rand(,)", the program runs...don't know why:)
Regards,
Xingzhi
0 Kudos
Reply