- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear developers,
the input
$cat test_rand.f
program test_rand
implicit none
real rand
write (*,*) rand()
end
compiles and executes fine with
$ ifort -O0 -xP test_rand.f
$ ./a.out
2.2477936E-05
but better optimization breaks it for me.
$ ifort -O1 -xP test_rand.f
$ ./a.out
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
a.out 08049F3C Unknown Unknown Unknown
a.out 08049E31 Unknown Unknown Unknown
libc.so.6 F7E275F5 Unknown Unknown Unknown
a.out 08049D61 Unknown Unknown Unknown
This happens with the 32bit version of ifort 10.1.018 under 64bit SUSE Linux 11.0, and also with the 32bit version of ifort 10.1.013 under 32bit SUSE Linux 10.1
Is this a misunderstanding of rand() (i.e. bad fortran code) or a compiler bug?
Regards,
Volker Koch
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The documented usage of RAND and RANDOM requires accessing these portability routines with USE IFPORT. The program runs successfully if you modify the program as shown below.
[cpp]program test_rand
USE IFPORT
implicit none
write (*,*) rand()
end[/cpp]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear developers,
the input
$cat test_rand.f
program test_rand
implicit none
real rand
write (*,*) rand()
end
compiles and executes fine with
$ ifort -O0 -xP test_rand.f
$ ./a.out
2.2477936E-05
but better optimization breaks it for me.
$ ifort -O1 -xP test_rand.f
$ ./a.out
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
a.out 08049F3C Unknown Unknown Unknown
a.out 08049E31 Unknown Unknown Unknown
libc.so.6 F7E275F5 Unknown Unknown Unknown
a.out 08049D61 Unknown Unknown Unknown
This happens with the 32bit version of ifort 10.1.018 under 64bit SUSE Linux 11.0, and also with the 32bit version of ifort 10.1.013 under 32bit SUSE Linux 10.1
Is this a misunderstanding of rand() (i.e. bad fortran code) or a compiler bug?
Regards,
Volker Koch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
USE IFPORT is required, to supply an interface block to enable a call with no argument. Debug mode is more tolerant of caller/callee stack mis-match. This one has been discussed before, probably on the Windows side.
![](/skins/images/98E68944C1FF703B8AC50091329B92AF/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page