This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: possibly incorrect g77 syntax error message


Emil Hallin wrote:

> When I compile the following fortran function with g77 I get a syntax
> error that I think is not correct (it compiles fine on Watcom 11
> fortran). I have included the fortran file and error message as
> attachments for those who might prefer to see them that way.

> Here is the error message I get:
> g77 -c test123.f -o test123.o
> test123.f: In function `tryit':
> test123.f:12:
>     &     349.7120367495403d0, 267.4315454437577d0, 213.0444007033096d0
>              ^
> Period at (^) not followed by digits for floating-point number or
> by `NOT.', `TRUE.', or `FALSE.'

Ah, this one is simple, actually.  Recall that Fortran 77 (and earlier)
uses a fixed form source code, with significant columns of text between
column 7 and 72.  Column 6 was reserved for "continuation" indicators.

So:
    1         2         3         4         5         6         7
678901234567890123456789012345678901234567890123456789012345678901234
&    5096.968116166064d0,  533.2677925364562d0, -84.36499146072562d0,
&     349.7120367495403d0, 267.4315454437577d0, 213.0444007033096d0,

and the `d0,' gets truncated to just `d'.  After that, the lexer loses
track and the following error messages are just gibberish.

Moral:  Always edit Fortran source code in 80 column vi windows, with
`set number' on.

Hope this helps,

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://g95.sourceforge.net/ (under construction)

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