Bug 13257 - [4.0 only] Error instead of warning for missing comma in format string
Summary: [4.0 only] Error instead of warning for missing comma in format string
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: tree-ssa
: P2 enhancement
Target Milestone: 4.0.2
Assignee: Andrew Pinski
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: diagnostic, patch
Depends on:
Blocks: 15502 19292
  Show dependency treegraph
 
Reported: 2003-12-01 05:18 UTC by Dan Nicolaescu
Modified: 2005-07-16 20:46 UTC (History)
4 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work: 4.1.0
Known to fail:
Last reconfirmed: 2004-12-24 02:25:47


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Nicolaescu 2003-12-01 05:18:19 UTC
With: gcc version 3.5-tree-ssa 20031130 (merged 20031123)

test.f90
      subroutine mysub
      dimension ibar(5)
      write (3,1001) ( ibar(m), m = 1, 5 )

 1001 format (/5x,' ',i4' '/ )
      return
      end

gfortran -c test.f90 -ffixed-form                                              
                                               In file test.f90:5

 1001 format (/5x,' ',i4' '/ )
                           1
Error: Missing comma in format string at (1)
 In file test.f90:3

      write (3,1001) ( ibar(m), m = 1, 5 )
                  1
Error: FORMAT label 1001 at (1) not defined

g77 gives a warning, but still compiles the code.

Intel's compiler compiles the above code.

Code like this appears in SPEC95
Comment 1 Andrew Pinski 2003-12-02 15:43:53 UTC
Confirmed.
Comment 2 Andrew Pinski 2005-01-08 20:38:59 UTC
This also appears in SPEC 2000 also in galgel (why we don't reject it on x86 I have no idea).
Comment 3 Andrew Pinski 2005-04-08 14:27:06 UTC
I have a fix which I am testing right now.
Comment 4 Andrew Pinski 2005-04-08 17:07:56 UTC
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-04/msg00874.html>.
Comment 5 CVS Commits 2005-04-09 18:44:13 UTC
Subject: Bug 13257

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pinskia@gcc.gnu.org	2005-04-09 18:44:07

Modified files:
	gcc/testsuite  : ChangeLog 
	libgfortran    : ChangeLog 
	libgfortran/io : format.c 
	gcc/fortran    : ChangeLog io.c 
Added files:
	gcc/testsuite/gfortran.dg: comma_format_extension_1.f 
	                           comma_format_extension_2.f 
	                           comma_format_extension_3.f 
	                           comma_format_extension_4.f 

Log message:
	PR fortran/13257
	
	fortran/ChangeLog:
	* io.c (check_format): Allow an optional comma
	between descriptors.
	
	libgfortran/ChangeLog:
	* format.c (parse_format_list): Allow an optional comma
	between descriptors.
	
	testsuite/ChangeLog:
	* comma_format_extension_[1234].f: New tests.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5311&r2=1.5312
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.184&r2=1.185
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/format.c.diff?cvsroot=gcc&r1=1.10&r2=1.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.384&r2=1.385
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/io.c.diff?cvsroot=gcc&r1=1.20&r2=1.21
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/comma_format_extension_1.f.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/comma_format_extension_2.f.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/comma_format_extension_3.f.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/comma_format_extension_4.f.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 6 Andrew Pinski 2005-04-09 18:46:49 UTC
Fixed on the mainline waiting for 4.0 branch to reopen to apply there.
Comment 7 Giovanni Bajo 2005-06-06 10:45:20 UTC
ping this, it looks like Andrew just missed 4.0.1 too for this bug :)
Comment 8 CVS Commits 2005-07-16 20:46:31 UTC
Subject: Bug 13257

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	pinskia@gcc.gnu.org	2005-07-16 20:46:23

Modified files:
	gcc/fortran    : ChangeLog io.c 
	gcc/testsuite  : ChangeLog 
	libgfortran    : ChangeLog 
	libgfortran/io : format.c 
Added files:
	gcc/testsuite/gfortran.dg: comma_format_extension_1.f 
	                           comma_format_extension_2.f 
	                           comma_format_extension_3.f 
	                           comma_format_extension_4.f 

Log message:
	2005-07-16  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR fortran/13257
	* io.c (check_format): Allow an optional comma
	between descriptors.
	
	2005-07-16  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR fortran/13257
	* format.c (parse_format_list): Allow an optional comma
	between descriptors.
	
	2005-07-16  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR fortran/13257
	* comma_format_extension_[1234].f: New tests.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.335.2.91&r2=1.335.2.92
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/io.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.19.10.6&r2=1.19.10.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.282&r2=1.5084.2.283
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/comma_format_extension_1.f.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.10.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/comma_format_extension_2.f.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.10.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/comma_format_extension_3.f.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.10.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/comma_format_extension_4.f.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.10.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.163.2.63&r2=1.163.2.64
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/format.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.9.12.2&r2=1.9.12.3

Comment 9 Andrew Pinski 2005-07-16 20:46:52 UTC
Fixed.