FORTRAN IV DATA statements

Steve Kargl sgk@troutmask.apl.washington.edu
Tue Sep 1 14:39:00 GMT 2009


On Tue, Sep 01, 2009 at 04:17:47PM +0200, Tobias Burnus wrote:
> Hi Stephan,
> 
> On 09/01/2009 02:53 PM, Stephan Buchert wrote:
> > The offending lines are
> >       COMMON/DATIME/ISDATE(3),ISTIME(2),NAME(2)
> >       DATA ISDATE/'01-F','EB-0','2   '/,ISTIME/'15:4','9:27'/
> > and the like (ISDATE implicitly declared a 3 element integer array and
> > expected to hold a 12 character long string). [...]
> >
> > I believe that such DATA statements were allowed in FORTRAN IV and
> > FORTRAN 66
> 
> > However, g77 does compile the NRLMSISE-00 code (albeit with warnings due
> > to other "clever" constructs).
> > Is there a way to get the NRLMSISE-00 code compiled with gfortran or is
> > the no longer maintained g77 presently the only option within gcc? If
> > yes, I would suggest to add an option to gfortran that allows to compile
> > even FORTRAN 66/IV programs, if that is not too much work.
> 
> gfortran currently does not support this thus g77 seems to be the only
> option in GCC. I think one can consider adding support for it in
> gfortran using the -std=legacy option. There are two reasons for adding
> it: (a) It is supported by g77 and gfortran strives for compatibility
> with g77 and (b) it is reasonably clear what the result should be and it
> is relatively easy to implement.
> 
> Can you fill a bugreport?

Please, no.  gfortran should not become a cesspool of
supporting ugly nonstandard code.  It makes code maintenance
and development of actual required Fortran feature more
difficult.

A much better solution is to fix the Fortran code.

       COMMON/DATIME/ISDATE(3),ISTIME(2),NAME(2)
       SAVE ISDATE, ISTIME
       ISDATE=TRANSFER('01-FEB-02   ', ISDATE)
       ISTIME=TRANSFER('15:49:27', ISTIME)

or change the types of ISDATE and ISTIME to CHARACTER(LEN=12) and
CHARACTER(LEN=8).  Afterall, the CHARACTER type has been available
for over 32 years.

-- 
Steve



More information about the Fortran mailing list