Bug 24268 - gfortran rejects valid format statement
Summary: gfortran rejects valid format statement
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.0.2
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2005-10-08 01:38 UTC by Iwan Kawrakow
Modified: 2006-01-08 02:22 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.0.0 4.1.0
Last reconfirmed: 2005-10-08 05:47:19


Attachments
A one line change that seems to fix Bug 24268 (188 bytes, patch)
2005-11-25 21:39 UTC, Iwan Kawrakow
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Iwan Kawrakow 2005-10-08 01:38:11 UTC
The following simple program is rejected by gfortran
(commandline: gfortran junk.f)
with this error message:

 In file junk.f:6

     *      1.4)
             1
Error: Period required in format string at (1)
 In file junk.f:4

      write(6,10) x
               1
Error: FORMAT label 10 at (1) not defined

c------------------------------ begin test program
      program junk
      real x
      read(5,*) x
      write(6,10) x
 10                                                            format(g1
     *      1.4)
      end
c------------------------------- end test program

The compilation succeeds with gcc 3.3.x and earlier
The compilation also succeeds if one removes the 
blanks beetwen the line continuation and 1.4 in the format statement.

additional info
gfortran -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/home/iwan/gcc4.0.2 --enable-threads=posix --enable-__cxa_atexit -enable-languages=c,c++,f95
Thread model: posix
gcc version 4.0.2
Comment 1 Jerry DeLisle 2005-10-08 03:24:27 UTC
Confirmed on latest 4.1 cvs.
Comment 2 Andrew Pinski 2005-10-08 05:47:19 UTC
Confirmed.
Comment 3 Iwan Kawrakow 2005-11-25 21:39:43 UTC
Created attachment 10339 [details]
A one line change that seems to fix Bug 24268

Have tested the change on several large fortran 77 source files.
I'm not sure if a similar change is needed for case '+' in 
format_lex().
Comment 4 Jerry DeLisle 2005-12-08 07:20:17 UTC
I am looking into this.
Comment 5 Jerry DeLisle 2005-12-16 23:44:18 UTC
Subject: Bug 24268

Author: jvdelisle
Date: Fri Dec 16 23:44:14 2005
New Revision: 108695

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108695
Log:
2005-12-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/24268
	* io.c (format_lex): Allow whitespace within text of format specifier.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/io.c

Comment 6 Jerry DeLisle 2005-12-16 23:49:38 UTC
Subject: Bug 24268

Author: jvdelisle
Date: Fri Dec 16 23:49:33 2005
New Revision: 108696

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108696
Log:
2005-12-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/24268
	* gfortran.dg/fmt_white.f: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/fmt_white.f
Modified:
    trunk/gcc/testsuite/ChangeLog

Comment 7 Jerry DeLisle 2005-12-21 06:51:06 UTC
Subject: Bug 24268

Author: jvdelisle
Date: Wed Dec 21 06:51:02 2005
New Revision: 108899

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108899
Log:
2005-12-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/24268
	* io.c (format_lex): Allow whitespace within text of format specifier.

Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/io.c

Comment 8 Jerry DeLisle 2005-12-21 06:52:40 UTC
Subject: Bug 24268

Author: jvdelisle
Date: Wed Dec 21 06:52:38 2005
New Revision: 108900

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108900
Log:
2005-12-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/24268
	* gfortran.dg/fmt_white.f: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/fmt_white.f
Modified:
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 9 Jerry DeLisle 2005-12-21 06:56:01 UTC
This is now fixed for the specific test case. 4.1 and 4.2 are in sync.  I plan to go back and review for other possible cases of whitespace.  Just want to keep this synchronized.
Comment 10 Jerry DeLisle 2006-01-02 08:13:04 UTC
Submitted a new patch for approval that is a final fix for this bug.
Comment 11 Jerry DeLisle 2006-01-06 01:22:02 UTC
Subject: Bug 24268

Author: jvdelisle
Date: Fri Jan  6 01:21:56 2006
New Revision: 109402

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109402
Log:
2006-01-01  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/24268
	* io.c (next_char_not_space): New function that returns the next
	character that is not white space.
	(format_lex): Use the new function to skip whitespace within
	a format string.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/io.c

Comment 12 Jerry DeLisle 2006-01-06 01:28:43 UTC
Subject: Bug 24268

Author: jvdelisle
Date: Fri Jan  6 01:28:40 2006
New Revision: 109404

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109404
Log:
2005-01-05  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/24268
	* gfortran.dg/fmt_white.f: Update test.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/fmt_white.f

Comment 13 Jerry DeLisle 2006-01-08 01:53:10 UTC
Subject: Bug 24268

Author: jvdelisle
Date: Sun Jan  8 01:53:06 2006
New Revision: 109467

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109467
Log:
2006-01-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/24268
	* io.c (next_char_not_space): New function that returns the next
	character that is not white space.
	(format_lex): Use the new function to skip whitespace within
	a format string.

Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/io.c

Comment 14 Jerry DeLisle 2006-01-08 01:56:27 UTC
Subject: Bug 24268

Author: jvdelisle
Date: Sun Jan  8 01:56:22 2006
New Revision: 109468

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109468
Log:
2005-01-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/24268
	* gfortran.dg/fmt_white.f: Update test.

Modified:
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/fmt_white.f

Comment 15 Jerry DeLisle 2006-01-08 02:22:37 UTC
Fixed on 4.1 and 4.2