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. Release: > g77 2.96 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) 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
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
From: toon@gcc.gnu.org To: gcc-gnats@gcc.gnu.org Cc: Subject: fortran/10197 Date: 24 Mar 2003 21:20:20 -0000 CVSROOT: /cvs/gcc Module name: gcc Changes by: toon@gcc.gnu.org 2003-03-24 21:20:20 Modified files: libf2c : ChangeLog libf2c/libI77 : open.c gcc/f : ChangeLog news.texi gcc/testsuite : ChangeLog Added files: gcc/testsuite/g77.f-torture/execute: 10197.f Log message: 2003-03-24 Bud Davis <bdavis9659@comcast.net> PR fortran/10197 * libI77/open.c (f_open): A DIRECT ACCESS file is UNFORMATTED by default. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libf2c/ChangeLog.diff?cvsroot=gcc&r1=1.193&r2=1.194 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libf2c/libI77/open.c.diff?cvsroot=gcc&r1=1.20&r2=1.21 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/f/ChangeLog.diff?cvsroot=gcc&r1=1.532&r2=1.533 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/f/news.texi.diff?cvsroot=gcc&r1=1.100&r2=1.101 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2535&r2=1.2536 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g77.f-torture/execute/10197.f.diff?cvsroot=gcc&r1=NONE&r2=1.1
From: toon@gcc.gnu.org To: gcc-gnats@gcc.gnu.org Cc: Subject: fortran/10197 Date: 24 Mar 2003 23:36:11 -0000 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: toon@gcc.gnu.org 2003-03-24 23:36:11 Modified files: libf2c : ChangeLog libf2c/libI77 : open.c gcc/f : ChangeLog news.texi gcc/testsuite : ChangeLog Added files: gcc/testsuite/g77.f-torture/execute: 10197.f Log message: 2003-03-24 Bud Davis <bdavis9659@comcast.net> PR fortran/10197 * libI77/open.c (f_open): A DIRECT ACCESS file is UNFORMATTED by default. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libf2c/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.186.2.3&r2=1.186.2.4 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libf2c/libI77/open.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.20&r2=1.20.14.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/f/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.503.2.16&r2=1.503.2.17 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/f/news.texi.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.92.2.6&r2=1.92.2.7 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.117&r2=1.2261.2.118 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g77.f-torture/execute/10197.f.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
Responsible-Changed-From-To: unassigned->toon Responsible-Changed-Why: Fortran Maintainer.
State-Changed-From-To: open->closed State-Changed-Why: Fixed using the patch suggested by submitter. Thanks !
Subject: Bug 10197 Author: nickc Date: Tue Jun 16 12:43:58 2009 New Revision: 148526 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148526 Log: PR 10197 * testsuite/test-demangle.c: Rename getline to get_line to avoid conflicts with system function of the same name. Modified: trunk/libiberty/ChangeLog trunk/libiberty/testsuite/test-demangle.c
Subject: Bug 10197 Author: jakub Date: Thu Jun 10 15:31:56 2010 New Revision: 160556 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=160556 Log: PR other/43838 * cp-demangle.c (struct d_print_info): Add flush_count field. (d_print_init): Initialize it to 0. (d_print_flush): Increment it. (d_print_comp): If needed flush before appending ", ". Only decrement dpi->len if no flushes happened during the recursive call. * testsuite/demangle-expected: Add a test for this. 2009-06-16 Nick Clifton <nickc@redhat.com> PR 10197 * testsuite/test-demangle.c: Rename getline to get_line to avoid conflicts with system function of the same name. Modified: branches/gcc-4_4-branch/libiberty/ChangeLog branches/gcc-4_4-branch/libiberty/cp-demangle.c branches/gcc-4_4-branch/libiberty/testsuite/demangle-expected branches/gcc-4_4-branch/libiberty/testsuite/test-demangle.c