This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/16908] New: Segfault in libgfortran/io/transfer.c
- From: "sgk at troutmask dot apl dot washington dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Aug 2004 22:44:54 -0000
- Subject: [Bug fortran/16908] New: Segfault in libgfortran/io/transfer.c
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Consider the following program:
program synsig
implicit none
integer n, nt, mt, m
real dt, tm, w
real, allocatable :: p(:)
nt = 2049 ! if nt < 2049, then everything works.
allocate(p(nt))
p = 0.e0
inquire(iolength=mt) (p(m), m=1, nt)
open(unit=12, file='syn.sax', access='direct', recl=mt)
n = 1
write(12, rec=n) mt, nt
write(12, rec=n+1) (p(m), m=1, nt)
close(12)
inquire(iolength=mt) (p(m), m=1, nt)
open(unit=12, file='syn.sax', access='direct', recl=mt)
n = 1
write(12, rec=n) mt, nt
write(12, rec=n+1) (p(m), m=1, nt)
close(12)
end program synsig
If nt >= 2049, then the second time the program tries to create the
data file 'syn.sax', the program will segfault.
Program terminated with signal 11, Segmentation fault.
#0 0x000000000041a633 in memset ()
(gdb) bt
#0 0x000000000041a633 in memset ()
#1 0x0000000000402553 in _gfortran_next_record (done=1)
at ../../../gcc/libgfortran/io/transfer.c:1235
#2 0x0000000000403474 in finalize_transfer () at
../../../gcc/libgfortran/io/transfer.c:1365
#3 0x0000000000403619 in _gfortran_st_write_done ()
at ../../../gcc/libgfortran/io/transfer.c:1482
#4 0x00000000004003ed in MAIN__ () at synsig.f90:18
#5 0x000000000040064e in main (argc=Variable "argc" is not available.
) at ../../../gcc/libgfortran/fmain.c:18
(gdb) list
18 MAIN__ ();
19
20 /* Bye-bye! */
21 return 0;
22 }
--
Summary: Segfault in libgfortran/io/transfer.c
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sgk at troutmask dot apl dot washington dot edu
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: 3.5.0 20040804
GCC host triplet: amd64-unknown-freebsd5.2
GCC target triplet: amd64
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16908