Bug 25419 - gfortran read does not take comma for default on one entry
Summary: gfortran read does not take comma for default on one entry
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libfortran (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: 4.1.0
Assignee: Jerry DeLisle
URL:
Keywords:
Depends on:
Blocks: 25594
  Show dependency treegraph
 
Reported: 2005-12-14 18:44 UTC by mast
Modified: 2006-01-01 05:19 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-12-26 06:00:20


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mast 2005-12-14 18:44:08 UTC
When there is a read statement expecting a single entry and a single
comma is entered, the read expects more input.

The test program is:

      stuff = 1
      stuff2 = 2
      write(*,'(1x,a,$)')'Enter 2 somethings: '
      read(5,*)stuff,stuff2
      write(*,'(1x,a,$)')'Enter something: '
      read(5,*)stuff
      call exit(0)
      end

[ashtray] image 205 % gfortran -o inputbug inputbug.f
[ashtray] image 206 % ./inputbug
 Enter 2 somethings: ,,
 Enter something: ,
,
/

[ashtray] image 207 %

It does not accept a , as a default entry for a single number, although two 
commas work when two numbers are expected.  Once it gets one comma it even refuses a / until a second return is entered.

This happens on Fedora Core 4 with gcc-gfortran-4.0.2-8.fc4
and on Mac OSX 10.4 with gcc version 4.1.0 20051026 (experimental)
Comment 1 Jerry DeLisle 2005-12-26 06:00:20 UTC
I have a fix for this already.  Patch for submottal soon.
Comment 2 Jerry DeLisle 2005-12-28 06:59:40 UTC
Subject: Bug 25419

Author: jvdelisle
Date: Wed Dec 28 06:59:35 2005
New Revision: 109099

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

	PR libgfortran/25419
	* io/list_read.c (list_formatted_read_scalar): Allow comma to return a
	null value (default).

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/list_read.c

Comment 3 Jerry DeLisle 2005-12-28 07:00:52 UTC
Subject: Bug 25419

Author: jvdelisle
Date: Wed Dec 28 07:00:47 2005
New Revision: 109100

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

	PR libgfortran/25419
	* gfortran.dg/comma.f: New test.

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

Comment 4 Jerry DeLisle 2005-12-30 07:03:55 UTC
The patch in comment #2 causes PR25594.
Comment 5 Jerry DeLisle 2006-01-01 02:45:31 UTC
Subject: Bug 25419

Author: jvdelisle
Date: Sun Jan  1 02:45:22 2006
New Revision: 109211

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

	PR libgfortran/25594
	PR libgfortran/25419
	* io/list_read.c (list_formatted_read_scalar): Test for comma to return
	a null value (default). Revert patch of 25419 on 2005-12-28.  

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/list_read.c

Comment 6 Jerry DeLisle 2006-01-01 05:04:11 UTC
Subject: Bug 25419

Author: jvdelisle
Date: Sun Jan  1 05:04:06 2006
New Revision: 109216

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

	PR libgfortran/25594
	PR libgfortran/25419
	* io/list_read.c (list_formatted_read_scalar): Test for comma to return
	a null value (default). Revert patch of 25419 on 2005-12-28.

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

Comment 7 Jerry DeLisle 2006-01-01 05:06:09 UTC
Subject: Bug 25419

Author: jvdelisle
Date: Sun Jan  1 05:06:05 2006
New Revision: 109217

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

	PR libgfortran/25419
	* gfortran.dg/comma.f: New test.

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

Comment 8 Jerry DeLisle 2006-01-01 05:16:10 UTC
Fixed on 4.1 and 4.2