- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I compiled the following code using the intel fortran compiler of version 8.1.018 and it showed a segmentation fault error while running on the intel pentium linux processor (kernel: 2.4.22). But the same code compiled by NAG compiler didn't show any runtime error and completed the run successfully.
Compilation command given:
ifort -o test.x test.f90
I would appreciate if you could point to any bugs in my code or in the way I used ifort.
program new
implicit none
integer::i,j,k,l,m,n
double precision,allocatable :: time(:,:,:)
l=1000
m=100
n=3
allocate(time(l,m,n))
open(11,file='bbb',action='read')
do i=1,l
if (mod(i,100)==0)write(*,*)i
do j=1,m
do k=1,n
read(11,*)time(i,j,:)
enddo
enddo
enddo
end
Using ifort, the segmentation fault appears when i=874.
Note: If I change the allocatable array into a hard-wired one (i.e., declare it as time(1000,100,3)), then the code does not give a segmentation fault, even when compiled with ifort.
Thanks in advance,
Bhargava
I compiled the following code using the intel fortran compiler of version 8.1.018 and it showed a segmentation fault error while running on the intel pentium linux processor (kernel: 2.4.22). But the same code compiled by NAG compiler didn't show any runtime error and completed the run successfully.
Compilation command given:
ifort -o test.x test.f90
I would appreciate if you could point to any bugs in my code or in the way I used ifort.
program new
implicit none
integer::i,j,k,l,m,n
double precision,allocatable :: time(:,:,:)
l=1000
m=100
n=3
allocate(time(l,m,n))
open(11,file='bbb',action='read')
do i=1,l
if (mod(i,100)==0)write(*,*)i
do j=1,m
do k=1,n
read(11,*)time(i,j,:)
enddo
enddo
enddo
end
Using ifort, the segmentation fault appears when i=874.
Note: If I change the allocatable array into a hard-wired one (i.e., declare it as time(1000,100,3)), then the code does not give a segmentation fault, even when compiled with ifort.
Thanks in advance,
Bhargava
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think I know what's going on here - the compiler is creating a stack temporary for the READ and not removing it from the stack inside the DO loop. I think this is fixed in 8.1.023.
As an alternative, use an implied DO loop instead of an array section.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page