public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* Windows gfortran namelist input error
@ 2016-05-11 22:47 David Drum
  2016-05-15 19:02 ` Jerry DeLisle
  0 siblings, 1 reply; 2+ messages in thread
From: David Drum @ 2016-05-11 22:47 UTC (permalink / raw)
  To: fortran

The following program works fine under Linux but fails under Windows.
      IMPLICIT REAL*8(A-H,O-Z)
      DIMENSION SENID(30)
      NAMELIST /FITH/ SENID
      DO I=1,30
         SENID(I) = I
      ENDDO
      OPEN(UNIT=7,FILE='TEST.OUT',FORM='FORMATTED',
     *         STATUS='NEW',ACTION='READWRITE')
      WRITE(7,NML=FITH)
      REWIND(7)
      READ(7,NML=FITH)
      END
The error is:
At line 11 of file xxx.f (unit = 7, file = 'TEST.OUT')
Fortran runtime error: Cannot match namelist object name 27.0000000000
I am using GNU Fortran (GCC) 5.3.1 20160402 under Windows. 
I believe the error is caused because the ^M line terminator (for DOS files) is interpreted as a value separator for namelist input.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Windows gfortran namelist input error
  2016-05-11 22:47 Windows gfortran namelist input error David Drum
@ 2016-05-15 19:02 ` Jerry DeLisle
  0 siblings, 0 replies; 2+ messages in thread
From: Jerry DeLisle @ 2016-05-15 19:02 UTC (permalink / raw)
  To: David Drum, fortran

On 05/11/2016 03:47 PM, David Drum wrote:
> The following program works fine under Linux but fails under Windows.
>       IMPLICIT REAL*8(A-H,O-Z)
>       DIMENSION SENID(30)
>       NAMELIST /FITH/ SENID
>       DO I=1,30
>          SENID(I) = I
>       ENDDO
>       OPEN(UNIT=7,FILE='TEST.OUT',FORM='FORMATTED',
>      *         STATUS='NEW',ACTION='READWRITE')
>       WRITE(7,NML=FITH)
>       REWIND(7)
>       READ(7,NML=FITH)
>       END
> The error is:
> At line 11 of file xxx.f (unit = 7, file = 'TEST.OUT')
> Fortran runtime error: Cannot match namelist object name 27.0000000000
> I am using GNU Fortran (GCC) 5.3.1 20160402 under Windows. 
> I believe the error is caused because the ^M line terminator (for DOS files) is interpreted as a value separator for namelist input.
> 

I have created bug report.

Bug 71123 - Namelist read failure on Windows

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

Regards,

Jerry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-15 19:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-11 22:47 Windows gfortran namelist input error David Drum
2016-05-15 19:02 ` Jerry DeLisle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).