Bug 24794 - problem with namelist input of character array
Summary: problem with namelist input of character array
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libfortran (show other bugs)
Version: 4.0.2
: P3 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-11 13:39 UTC by Christoph Jacob
Modified: 2005-12-12 20:08 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2005-11-11 16:32:13


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Jacob 2005-11-11 13:39:56 UTC
Here is a test program and an input file demostrating the
problem:

christoph@note-jacob ~/namelist $ cat namelist.f90

program bla

   implicit none
   integer, parameter :: maxop=15, iunit=7
   character*8 namea(maxop), nameb(maxop)
   integer i

   NAMELIST/CCSOPR/ NAMEA,NAMEB

   OPEN (iunit, file="input.nml", status='OLD')
   READ (iunit, CCSOPR)
   CLOSE (iunit)
   do i = 1, maxop
     write (*,*) "NAMEA (",i,") = ", NAMEA(i)
   end do
   do i = 1, maxop
     write (*,*) "NAMEB (",i,") = ", NAMEB(i)
   end do
end program bla

christoph@note-jacob ~/namelist $ cat input.nml
&CCSOPR
    NAMEA='SPI01H','SPI02O','SPI03H','SPI04O','SPI05H','SPI06H',
          'SPI07O','SPI08H','SPI09H',
    NAMEB='SPI01H','SPI03H','SPI05H','SPI06H','SPI08H','SPI09H',
&END
christoph@note-jacob ~/namelist $ gfortran namelist.f90
christoph@note-jacob ~/namelist $ ./a.out
 NAMEA (           1 ) = SPI01H
 NAMEA (           2 ) = SPI02O
 NAMEA (           3 ) = SPI03H
 NAMEA (           4 ) = SPI04O
 NAMEA (           5 ) = SPI05H
 NAMEA (           6 ) = SPI06H
 NAMEA (           7 ) = SPI07O
 NAMEA (           8 ) = SPI08H
 NAMEA (           9 ) = SPI09H
 NAMEA (          10 ) = NAMEB='S
 NAMEA (          11 ) = SPI03H
 NAMEA (          12 ) = SPI05H
 NAMEA (          13 ) = SPI06H
 NAMEA (          14 ) = SPI08H
 NAMEA (          15 ) = SPI09H
 NAMEB (           1 ) = 8\uffff\uffffii
 NAMEB (           2 ) = \uffff\uffff\uffff
 NAMEB (           3 ) = 8\uffff\uffff
 NAMEB (           4 ) = \uffff\uffff\uffff
 NAMEB (           5 ) = n\uffff\u0677\uffffJ\u0677
 NAMEB (           6 ) = \uffff\uffff\u0637
 NAMEB (           7 ) = `
 NAMEB (           8 ) = wP\uffff
 NAMEB (           9 ) = \uffff/\uffff\uffff
 NAMEB (          10 ) = \uffffx^\uffff\uffff
 NAMEB (          11 ) = \uffff6\uffff\uffff\uffff\uffff
 NAMEB (          12 ) = \uffff\uffff8
 NAMEB (          13 ) = \uffff\uffff
 NAMEB (          14 ) = Ht\uffff\uffff
 NAMEB (          15 ) = $\uffff
Comment 1 Jerry DeLisle 2005-11-11 16:32:13 UTC
Confirmed in 4.1
Comment 2 Jerry DeLisle 2005-11-19 20:43:49 UTC
I have the patch for this working and will be submitting to the list for approval soon.
Comment 3 Jerry DeLisle 2005-11-20 02:00:53 UTC
Patch submitted for review and approval.  Christoph, thankyou for submitting this PR and the example case.
Comment 4 Jerry DeLisle 2005-11-23 02:02:35 UTC
Subject: Bug 24794

Author: jvdelisle
Date: Wed Nov 23 02:02:31 2005
New Revision: 107394

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

	PR libgfortran/24794
	* io/list_read.c (read_character): Add auto completion on short
	namelist reads.

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

Comment 5 Jerry DeLisle 2005-11-23 02:14:29 UTC
Subject: Bug 24794

Author: jvdelisle
Date: Wed Nov 23 02:14:26 2005
New Revision: 107396

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

	PR libgfortran/24794
	* gfortran.dg/namelist_12.f: Fix quotes.
	* gfortran.dg/namelist_13.f90: Fix quotes.
	* gfortran.dg/namelist_14.f90: Fix quotes.
	* gfortran.dg/namelist_15.f90: Fix quotes.
	* gfortran.dg/namelist_use.f90: Fix quotes.
	* gfortran.dg/namelist_use_only.f90: Fix quotes.
	* gfortran.dg/namelist_21.f90: New test.
	* gfortran.dg/namelist_22.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/namelist_21.f90
    trunk/gcc/testsuite/gfortran.dg/namelist_22.f90
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/namelist_12.f
    trunk/gcc/testsuite/gfortran.dg/namelist_13.f90
    trunk/gcc/testsuite/gfortran.dg/namelist_14.f90
    trunk/gcc/testsuite/gfortran.dg/namelist_15.f90
    trunk/gcc/testsuite/gfortran.dg/namelist_use.f90
    trunk/gcc/testsuite/gfortran.dg/namelist_use_only.f90

Comment 6 Jerry DeLisle 2005-11-23 02:28:49 UTC
Subject: Bug 24794

Author: jvdelisle
Date: Wed Nov 23 02:28:44 2005
New Revision: 107397

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

	PR libgfortran/24794
	* gfortran.dg/namelist_12.f: Fix quotes.
	* gfortran.dg/namelist_13.f90: Fix quotes.
	* gfortran.dg/namelist_14.f90: Fix quotes.
	* gfortran.dg/namelist_15.f90: Fix quotes.
	* gfortran.dg/namelist_use.f90: Fix quotes.
	* gfortran.dg/namelist_use_only.f90: Fix quotes.
	* gfortran.dg/namelist_21.f90: New test.
	* gfortran.dg/namelist_22.f90: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_21.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_22.f90
Modified:
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_12.f
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_13.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_14.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_15.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_use.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_use_only.f90

Comment 7 Jerry DeLisle 2005-11-23 02:30:27 UTC
Subject: Bug 24794

Author: jvdelisle
Date: Wed Nov 23 02:30:23 2005
New Revision: 107399

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

	PR libgfortran/24794
	* io/list_read.c (read_character): Add auto completion on short
	namelist reads.

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

Comment 8 Jerry DeLisle 2005-11-23 20:57:57 UTC
Fixed in 4.1 and 4.2
Comment 9 Jerry DeLisle 2005-11-24 00:49:35 UTC
Fixed in 4.1 and 4.2, if someone has a dieing need for this in 4.0 let me know and  I will commit the fix there as well.