public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "bsp at kithrup dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/23321] New: Direct unformatted read beyond EOF cores Date: Thu, 11 Aug 2005 00:30:00 -0000 [thread overview] Message-ID: <20050811003038.23321.bsp@kithrup.com> (raw) c Summary: Direct unformatted read beyond EOF cores c This program demonstrates a bug in gfortran/libgfortran. c The bug is that a c program dumps core when reading beyond the end of c a access='direct', form='unformatted' file instead c of transfering control to 'err=' label. c Also, returns incorrectly when reading at end of file. c To test c dd if=/dev/zero of=shortfile bs=11811 count=1 c ./a.out c Bus error (core dumped) c dd if=/dev/zero of=shortfile bs=11812 count=1 c ./a.out c should not get here c before 779 inbuf(1)= 32 c STOP 0 c Note: in the above case, the value of inbuf(1) got set to a space c When compiled with ifort or g77, the correct output is produced c in both cases. c ./a.out c at 779, all is good c Problem occurs in c GNU Fortran 95 (GCC 4.0.1) c GNU Fortran 95 (GCC 4.0.2 20050804 (prerelease)) c GNU Fortran 95 (GCC 4.1.0 20050806 (experimental)) c gfortran -v c Using built-in specs. c Target: i686-pc-linux-gnu c Configured with: ../../NetSrc/gcc-4.1-20050806/configure --prefix=/home/bswift/afrl/ builddev/NetInst/gcc-4.1-20050806 --enable-languages=c,f95 --with-gmp=/home/bswift/afrl/ builddev/NetInst/gmp-4.1.4 --with-mpfr=/home/bswift/afrl/builddev/NetInst/mpfr-2.1.2 c Thread model: posix c gcc version 4.1.0 20050806 (experimental) implicit none integer nbytes integer inbuflen parameter (inbuflen=32768) integer*1 inbuf(inbuflen) integer k inbuf(1)=5 nbytes=11812 open(35,file='shortfile',access='direct',recl=nbytes,form $ ='unformatted') read(35,rec=2,err=779) (inbuf(k),k=1,nbytes) write(*,*) 'should not get here' write(*,*) 'before 779 inbuf(1)=',inbuf(1) stop 779 write(*,*) 'at 779, all is good' end -- Summary: Direct unformatted read beyond EOF cores Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libfortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bsp at kithrup dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23321
next reply other threads:[~2005-08-11 0:30 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-08-11 0:30 bsp at kithrup dot com [this message] 2005-08-11 13:31 ` [Bug libfortran/23321] " pinskia at gcc dot gnu dot org 2005-08-14 21:39 ` tkoenig at gcc dot gnu dot org 2005-08-15 22:32 ` tkoenig at gcc dot gnu dot org 2005-09-04 20:37 ` cvs-commit at gcc dot gnu dot org 2005-09-04 20:45 ` cvs-commit at gcc dot gnu dot org 2005-09-04 20:50 ` tkoenig at gcc dot gnu dot org 2005-09-04 21:26 ` pinskia at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20050811003038.23321.bsp@kithrup.com \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).