public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: bdavis9659@comcast.net
To: gcc-gnats@gcc.gnu.org
Subject: fortran/10197: direct acces files not unformatted by default
Date: Mon, 24 Mar 2003 02:56:00 -0000	[thread overview]
Message-ID: <20030324003447.748.qmail@sources.redhat.com> (raw)


>Number:         10197
>Category:       fortran
>Synopsis:       direct acces files not unformatted by default
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 24 00:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     bud davis
>Release:        > g77 2.96
>Organization:
>Environment:
[bdavis@rh gcc]$ /usr/local/bin/g77 -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs
Configured with: ../gcc/configure --enable-languages=f77,c --enable-checking
Thread model: posix
gcc version 3.4 20030323 (experimental)
>Description:
OPEN(..ACCESS='DIRECT'..) should open a file with FORM='UNFORMATTED'. 

It is being opened with FORM='FORMATTED', which causes a runtime error on the first unformatted I/O.

This is correct on g77 2.96, and not on the pre-release g77 3.3 or g77 3.4.

At the risk of being proven wrong by a plethora of language lawyers:):)

The FORTAN-77 standard, section 12.10.1 states; when discussing FORM=

"If this specifier is omitted, a value of UNFORMATTED is assumed if the file is being connected for direct access, and a value of FORMATTED is assumed if the file is being connected for sequential access. "

So, IMHO, this is how it should work.
>How-To-Repeat:
C demonstrate a direct access file is by default unformatted
       IMPLICIT NONE
       LOGICAL*4 ERROR /.FALSE./
       CHARACTER*12 FORM
       DATA FORM   / ''        /
       OPEN(UNIT=60,
     1      ACCESS='DIRECT',
     2      STATUS='SCRATCH',
     3      RECL=255)
       INQUIRE(UNIT=60,FORM=FORM)
       IF (FORM.EQ.'UNFORMATTED') THEN
          PRINT*,'FORM IS ',FORM,' WHICH IS CORRECT.'
       ELSE
          PRINT*,'FORM IS ',FORM,' S/B UNFORMATTED.'
          ERROR = .TRUE.
       ENDIF
       CLOSE(UNIT=60)
       IF (ERROR) CALL ABORT
       END

example run with g77 3.4

[bdavis@rh bin]$ /usr/local/bin/g77 -static -v -g -o open open.f
Driving: /usr/local/bin/g77 -static -v -g -o open open.f -lfrtbegin -lg2c -lm
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs
Configured with: ../gcc/configure --enable-checking --enable-languages=f77,c
Thread model: posix
gcc version 3.4 20030323 (experimental)
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.4/f771 open.f -quiet -dumpbase open.f -auxbase open -g -version -o /tmp/cc7EOAQ9.s
GNU F77 version 3.4 20030323 (experimental) (i686-pc-linux-gnu)
	compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.3 2.96-113).
GGC heuristics: --param ggc-min-expand=63 --param ggc-min-heapsize=62241
 as -V -Qy -o /tmp/ccwslAzc.o /tmp/cc7EOAQ9.s
GNU assembler version 2.11.93.0.2 (i386-redhat-linux) using BFD version 2.11.93.0.2 20020207
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.4/collect2 -m elf_i386 -static -o open /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.4/crtbeginT.o -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.4 -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.4/../../.. /tmp/ccwslAzc.o -lfrtbegin -lg2c -lm -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.4/crtend.o /usr/lib/crtn.o
[bdavis@rh bin]$ ./open
 FORM IS FORMATTED    S/B UNFORMATTED.
Fortran abort routine called
Abort (core dumped)

run with gcc2.96
[bdavis@rh bin]$ g77 -static -v -g -o open open.f
g77 version 2.96 20000731 (Red Hat Linux 7.3 2.96-113) (from FSF-g77 version 0.5.26 20000731 (Red Hat Linux 7.3 2.96-113))
Driving: g77 -static -v -g -o open open.f -lg2c -lm
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113)
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/f771 open.f -quiet -dumpbase open.f -g -version -o /tmp/cctO7UwQ.s
GNU F77 version 2.96 20000731 (Red Hat Linux 7.3 2.96-113) (i386-redhat-linux) compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.3 2.96-113).
 as -V -Qy -o /tmp/ccxotX8Q.o /tmp/cctO7UwQ.s
GNU assembler version 2.11.93.0.2 (i386-redhat-linux) using BFD version 2.11.93.0.2 20020207
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/collect2 -m elf_i386 -static -o open /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crti.o /usr/lib/gcc-lib/i386-redhat-linux/2.96/crtbegin.o -L/usr/lib/gcc-lib/i386-redhat-linux/2.96 -L/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../.. /tmp/ccxotX8Q.o -lg2c -lm -lgcc -lc -lgcc /usr/lib/gcc-lib/i386-redhat-linux/2.96/crtend.o /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crtn.o[bdavis@rh bin]$ ./open
 FORM IS UNFORMATTED  WHICH IS CORRECT.


>Fix:
Index: gcc/libf2c/libI77/open.c
===================================================================
RCS file: /cvs/gcc/gcc/libf2c/libI77/open.c,v
retrieving revision 1.20
diff -c -3 -p -r1.20 open.c
*** gcc/libf2c/libI77/open.c    10 Jul 2002 21:17:29 -0000      1.20
--- gcc/libf2c/libI77/open.c    24 Mar 2003 00:30:17 -0000
*************** f_open (olist * a)
*** 148,154 ****
    b->url = (int) a->orl;
    b->ublnk = a->oblnk && (*a->oblnk == 'z' || *a->oblnk == 'Z');
    if (a->ofm == 0)
!     b->ufmt = 1;
    else if (*a->ofm == 'f' || *a->ofm == 'F')
      b->ufmt = 1;
    else
--- 148,159 ----
    b->url = (int) a->orl;
    b->ublnk = a->oblnk && (*a->oblnk == 'z' || *a->oblnk == 'Z');
    if (a->ofm == 0)
!     {
!        if ((a->oacc) && (*a->oacc == 'D'  || *a->oacc == 'd'))
!          b->ufmt = 0;
!        else
!          b->ufmt = 1;
!     }
    else if (*a->ofm == 'f' || *a->ofm == 'F')
      b->ufmt = 1;
    else
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2003-03-24  0:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-24  2:56 bdavis9659 [this message]
2003-03-24 14:26 Tim Prince
2003-03-25  8:56 toon

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=20030324003447.748.qmail@sources.redhat.com \
    --to=bdavis9659@comcast.net \
    --cc=gcc-gnats@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: link
Be 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).