------- Comment #2 from cgerdy at wanadoo dot fr 2010-02-18 23:22 ------- Subject: Re: bug with gfortran on Windows vista, correct on Linux
You have not understand the problem : It is a gfortran bug, with and only with Windows, you must test this problem with Windows not Linux. The listing of the Fortran file is : Fortran95 file : use iso_fortran_env implicit none integer,parameter:: mligne = 10000,n2 = 10 character(len = n2 + 2):: ligne ! the bug is here 2 is not necessary for reading essai.f95 : 10 max character per line ! character(len = n2 ):: ligne ! the bug is here, did not work : only 8 max character per line ! character(len = n2 + 1):: ligne ! the bug is here, did not work : only 9 max character per line character(len = 260):: string integer:: i,j,iosta,nligne write(output_unit,*) ' name of he file to read' read(input_unit,*) string open(unit = 7,action = 'read',file = string) do i = 1,mligne read(unit = 7,fmt = '(a)',iostat = iosta) ligne if(iosta .eq. iostat_end) go to 100 if(iosta .eq. iostat_eor) go to 200 200 continue end do 100 continue close(unit = 7) nligne = i - 1 write(6,*) "number of read lines = ",nligne end end of Fortran95 file The file to read is, and it is only if you read this file you understand the problem, and this file must be a Windows file not a Linux file. Generate it with the notepad but in Windows. All the testing work must be made with Windows not Linux. file to read : essai.f95 12345 123456 1234567 12345678 123456789 1234567890 123456789 12345678 1234567 123456 12345 end of file to read it is with lines of 10 and 9 characters you have problems with n2 = 10 in the Fortan95 program and only with Windows, my Windows is Vista No problem with gfortran on Linux : my Linux is : Suse11.2 It is the same problem with the use of iomsg=str in the read statement and no iostat The NAG Compiler as the same problem on Windows and not with Linux, exactly the same as with gfortran ----- Original Message ----- From: "kargl at gcc dot gnu dot org" <gcc-bugzi...@gcc.gnu.org> To: <cge...@wanadoo.fr> Sent: Thursday, February 18, 2010 7:15 PM Subject: [Bug fortran/43115] bug with gfortran on Windows vista, correct on Linux > > > > ------- Comment #1 from kargl at gcc dot gnu dot org 2010-02-18 > 18:15 ------- > Please attach the files to the PR. Cut and paste from > bugzilla will mangle the files; particularly, if it is > a CRLF problem. > > Also, try removing your iostat usage and see if the > the operating system generates an error, or use > iomsg. Something like > > str = 'OK' > open(unit = 7, action = 'read', file = string) > do i = 1,mligne > read(unit = 7, fmt = '(a)', iostat = iosta, iomsg=str) ligne > print *, trim(str) > > On FreeBSD, I get > troutmask:sgk[223] ./z > name of he file to read > abc > OK > OK > OK > OK > OK > OK > OK > OK > OK > OK > OK > End of file > number of read lines = 11 > > > -- > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43115 > > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. > > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43115