public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* fortran/10197: direct acces files not unformatted by default
@ 2003-03-24  2:56 bdavis9659
  0 siblings, 0 replies; 3+ messages in thread
From: bdavis9659 @ 2003-03-24  2:56 UTC (permalink / raw)
  To: gcc-gnats


>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:


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

* Re: fortran/10197: direct acces files not unformatted by default
@ 2003-03-25  8:56 toon
  0 siblings, 0 replies; 3+ messages in thread
From: toon @ 2003-03-25  8:56 UTC (permalink / raw)
  To: bdavis9659, gcc-bugs, gcc-prs, nobody, toon

Synopsis: direct acces files not unformatted by default

Responsible-Changed-From-To: unassigned->toon
Responsible-Changed-By: toon
Responsible-Changed-When: Tue Mar 25 08:37:31 2003
Responsible-Changed-Why:
    Fortran Maintainer.
State-Changed-From-To: open->closed
State-Changed-By: toon
State-Changed-When: Tue Mar 25 08:37:31 2003
State-Changed-Why:
    Fixed using the patch suggested by submitter.  Thanks !

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10197


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

* Re: fortran/10197: direct acces files not unformatted by default
@ 2003-03-24 14:26 Tim Prince
  0 siblings, 0 replies; 3+ messages in thread
From: Tim Prince @ 2003-03-24 14:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR fortran/10197; it has been noted by GNATS.

From: Tim Prince <timothyprince@sbcglobal.net>
To: bdavis9659@comcast.net, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: fortran/10197: direct acces files not unformatted by default
Date: Mon, 24 Mar 2003 06:15:26 -0800

 On Sunday 23 March 2003 16:34, bdavis9659@comcast.net wrote:
 > >Number:         10197
 > >Category:       fortran
 > >Synopsis:       direct acces files not unformatted by default
 
 > 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
 >
 I "sent mail to interested parties," but, AFAICT, all the interested parties 
 selected by gnats-web bounced my mail.  I pointed out that the version of 
 open.c included in gcc-3.2.2 implements the standard, in accordance with 
 Bud's test.  I rebuilt gcc-3.3 with that version of open.c, and it passed 
 Bud's test.  So, gcc-3.3 has a regression from gcc-3.2.2, apparently caused 
 by an out of date libf2c.
 -- 
 Tim Prince


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

end of thread, other threads:[~2003-03-25  8:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-24  2:56 fortran/10197: direct acces files not unformatted by default bdavis9659
2003-03-24 14:26 Tim Prince
2003-03-25  8:56 toon

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