https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86065

            Bug ID: 86065
           Summary: gfortran NAMELIST improperly reads arrays that span
                    more than one line.
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: charlie at sallyandcharlie dot com
  Target Milestone: ---

gfortran NAMELIST improperly reads arrays that span more than one line.

It skips an array position for lines ending with ",\n"

--------- Example Input File ---------
$MY_INP
  i = 1,2,3,4,
      5,6,7,8,
      9,10,11,12,
$END

---------- Example Output from Code Below ----------
Output:
1 2 3 4 0 5 6 7 8 0  9 10 11 12  0  0  0  0  0  0
        ^         ^
Skips an array entry with each new line

-------------- Example Code ---------------
compiled with: 
gfortran read_arr.f  -finit-local-zero -o read_arr.exe

-----------------File: read_arr.f--------------------------
      program NL_ERR

      dimension i(20)

      namelist /MY_INP/i

      open(5,file='a.inp', status='OLD')
      read(5, MY_INP, end=9)

  9   write(*, '(10I2, 10I3)')(i(j), j=1,20)

      stop
      end

-------------- Working Input File ----------------
If the trailing commas are removed, it works properly
---------------------------------------------------
$MY_INP
  i = 1,2,3,4
      5,6,7,8
      9,10,11,12,
$END

Output:
1 2 3 4 5 6 7 8 910 11 12  0  0  0  0  0  0  0  0

Reply via email to