g77 inconsistency?

Toon Moene toon@moene.indiv.nluug.nl
Sun Mar 6 01:13:00 GMT 2005


Christos Tountas wrote:

> Hello,
> 
> "Ugly" initialization of numeric variables with text strings seems
> to work for some types of numeric variables only.
> 
> The following works:
>     integer i
>     data i /'abcd'/
> 
> But this does not:
>     real*8 r
>     data r /'abcdefgh'/
> 
> More than a dozen compilers  on different platforms over the years
> have done this correctly. Cannot get g77 to do it with
> any combination of options. I have a lot of old code that needs it.
> Any hope?

The following works (due to the fact that holleriths are used in stead 
of plain constant strings):

       integer i
       data i /'abcd'/
       real r
       data r /4habcd/
       real*8 d
       data d /8habcdefgh/
       print*,i
       print*,r
       print*,d
       end

Note that development on g77 has stopped.  New development is only going 
on with gfortran (see: http://gcc.gnu.org/fortran).

Kind regards,

-- 
Toon Moene - e-mail: toon@moene.indiv.nluug.nl - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
A maintainer of GNU Fortran 95: http://gcc.gnu.org/fortran/



More information about the Gcc-help mailing list