This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gfortran47, pgf90 work - ifort segfaults


On Linux 2.6.18-194.32.1.el5 #1 SMP x86_64 x86_64 x86_64
I've 3 compilers:

Portland: pgf90 11.10-0 64-bit target on x86-64 Linux -tp penryn 
GCC: 4.7.0 20120128
Intel: 12.0.2 20110112

The code below segfaults only when compiled with Intel compiler.
Before blaming an Intel compiler bug,
what could be wrong with this code:

bigblue4> cat z.f90 
program z

 integer,parameter :: ou=101

 integer :: space1(0:201,0:201,0:201)

 space1=12345

 open(unit=ou,file="test", form="unformatted", &
   access="stream", status="replace")

 write(unit=ou) space1(1:201,:,:)

 close(unit=ou)

 end
bigblue4> gfortran z.f90 
bigblue4> ./a.out 
bigblue4> pgf90 z.f90
bigblue4> ./a.out 
bigblue4> ifort z.f90 
bigblue4> ./a.out 
Segmentation fault
bigblue4>

I know it's something to do with stream output
and array indexing. If I modify the write
line to either of these:

 write(unit=ou) space1
 write(unit=ou) space1(:,:,:)
 write(unit=ou) space1(0:201,:,:)

there is no segfault with intel.

However, these do segfault with intel:

 write(unit=ou) space1(1:200,:,:)
 write(unit=ou) space1(0:200,:,:)
 write(unit=ou) space1(10:200,:,:)
 write(unit=ou) space1(10:199,:,:)

Is there anything in stream output that
can lead to such behaviour?

Thanks

-- 
Anton Shterenlikht
Room 2.6, Queen's Building
Mech Eng Dept
Bristol University
University Walk, Bristol BS8 1TR, UK
Tel: +44 (0)117 331 5944
Fax: +44 (0)117 929 4423


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]