public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34795]  New: inquire statement , direct= specifier incorrectly returns YES
@ 2008-01-15 13:05 kendrick dot killian at colostate dot edu
  2008-01-15 20:04 ` [Bug fortran/34795] " burnus at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: kendrick dot killian at colostate dot edu @ 2008-01-15 13:05 UTC (permalink / raw)
  To: gcc-bugs

The inquire direct= specifier always returns YES regardless how the file is
created or actually opened.


The bug has been seen on gfortran versions
 gcc version 4.1.0 20060304 (Red Hat 4.1.0-3)   Target: x86_64-redhat-linux
 gcc version 4.1.1 20061011 (Red Hat 4.1.1-30)  Target: i386-redhat-linux
 gcc version 4.1.2 20070925 (Red Hat 4.1.2-27)  Target: x86_64-redhat-linux
 gcc version 4.2.0 20060713 (experimental)      Target: powerpc-apple-darwin8

Causes code that depends on the returned value to read the file incorrectly and
generate an I/O error


Bug is reproducible with a simple program
==========================================================
      program testdirect
      character drct*4, acc*12
      logical opn

      open(unit=19,file='testdirect.f',status='OLD',err=170)
      inquire(unit=19, direct=drct, opened=opn, access=acc)
      write(*,*) "default open drct=",drct, "opened=",opn, "access=",acc
      close(19)

      open(unit=19,file='testdirect.f',status='OLD',err=170,
     &     access='SEQUENTIAL')
      inquire(unit=19, direct=drct, opened=opn, access=acc)
      write(*,*) "Sequent open drct=",drct, "opened=",opn, "access=",acc
      close(19)

      open(unit=19,file='testdirect.f',status='OLD',err=170,
     &     form='UNFORMATTED',access='DIRECT',recl=72)
      inquire(unit=19, direct=drct, opened=opn, access=acc)
      write(*,*) "direct  open drct=",drct, "opened=",opn, "access=",acc
      close(19)
      stop

170   write(*,*) "ERROR: unable to open testdirect.f"
      end
====================================================================

file name:     testdirect.f
compiled with: gfortran testdirect.f

File output:
 default open drct=YES opened= T access=SEQUENTIAL  
 Sequent open drct=YES opened= T access=SEQUENTIAL  
 direct  open drct=YES opened= T access=DIRECT      


correct output (produced by g77)
 default open drct=NO  opened= T access=SEQUENTIAL  
 Sequent open drct=NO  opened= T access=SEQUENTIAL  
 direct  open drct=YES opened= T access=DIRECT


-- 
           Summary: inquire statement , direct= specifier incorrectly
                    returns YES
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kendrick dot killian at colostate dot edu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34795


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-01-20  7:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-15 13:05 [Bug fortran/34795] New: inquire statement , direct= specifier incorrectly returns YES kendrick dot killian at colostate dot edu
2008-01-15 20:04 ` [Bug fortran/34795] " burnus at gcc dot gnu dot org
2008-01-16  2:34 ` kendrick dot killian at colostate dot edu
2008-01-16  4:30 ` jvdelisle at gcc dot gnu dot org
2008-01-16  7:24 ` jvdelisle at gcc dot gnu dot org
2008-01-16  7:52 ` jvdelisle at gcc dot gnu dot org
2008-01-19 16:32 ` jvdelisle at gcc dot gnu dot org
2008-01-20  8:02 ` jvdelisle at gcc dot gnu dot org
2008-01-20  8:09 ` jvdelisle at gcc dot gnu dot org

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).