This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: READ ( UNIT = TRIM(String),...


Thanks a lot for your reply!

I forgot to mention that this IOSTAT oddity seems to be highly dependant
on the leading "/": without gfortran does return a non-0!

Philippe

François-Xavier Coudert wrote:
> 
> > READ ( UNIT = TRIM(String), FMT = *, IOSTAT = IO_Stat ) Number
> >                   1
> > Error: UNIT specification at (1) must be an INTEGER expression or a
> > CHARACTER variable
> >
> > Is this warranted by the standard?
> 
> Yes. From Fortran 2003, section 9.4 "File Connection":
> 
> R901 io-unit is file-unit-number or * or internal-file-variable
> R902 file-unit-number is scalar-int-expr
> R903 internal-file-variable is char-variable
> 
> So gfortran's message is very much on par.
> 
> > Now for the really weird part, if I remove the 'TRIM' to get over this,
> > I would expect an IO error to be raised, but I have yet to find a
> > compiler which does!
> 
> I don't know. Since gfortran's behaviour is similar to other
> compilers, it's probably a language question and would be better
> directed to comp.lang.fortran.
> 
> FX


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]