public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* possibly incorrect g77 syntax error message
@ 2000-05-26 11:22 Emil Hallin
  2000-05-26 12:11 ` Emil Hallin
  2000-05-26 14:20 ` Toon Moene
  0 siblings, 2 replies; 3+ messages in thread
From: Emil Hallin @ 2000-05-26 11:22 UTC (permalink / raw)
  To: gcc

Hi,
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 version of g77 I am using (same thing happens with current
CVS source built on intel linux RH6.1): 

g77 --version
GNU Fortran 0.5.25 19991024 (release)
Copyright (C) 1997 Free Software Foundation, Inc.
For more version information on components of the GNU Fortran
compilation system, especially useful when reporting bugs,
type the command `g77 --verbose'.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
or type the command `info -f g77 Copying'.

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.'
test123.f:12:
    &     349.7120367495403d0, 267.4315454437577d0, 213.0444007033096d0
             ^
Invalid form for DATA statement at (^)
test123.f:12:
    &     349.7120367495403d0, 267.4315454437577d0, 213.0444007033096d0
             ^
Too few initial values in list of initializers for `a' at (^)

The snippet of code is as follows:
      double precision function tryit(k)
      implicit double precision (a-h,o-z)
      dimension a(100)
      data (a(k),k=1,100)/
     &  461904.6285714286d0,-338522.8172195650d0,-134188.3826330945d0,
     & 1224917.281612405d0,  839777.8119190406d0, -14722.27542354662d0,
     &  -28752.76677743963d0, 17559.71526102492d0,  7531.385520293790d0,
     &   10162.59993007690d0,-59637.19030976763d0,-52592.20471033397d0,
     &   -1509.943936916021d0, 3429.465514693014d0,-1694.234343945828d0,
     &    -412.4642513588372d0,-771.8756555594653d0,5048.147334278087d0,
     &    5096.968116166064d0,  533.2677925364562d0,
-84.36499146072562d0,
     &     349.7120367495403d0, 267.4315454437577d0,
213.0444007033096d0,
     &    -248.2444723301185d0,-313.9326637677008d0, 
27.83649754041712d0,
     &     177.7370877639193d0, 
12.32298112940429d0,133.6789475533487d0,
     &      18.64085535065390d0,152.7005644513549d0, 
74.22321838037993d0,
     &     110.7911828183424d0,  33.51924585712681d0,
77.32667442499877d0,
     &      53.23602577975604d0, 57.18682258944803d0,
49.49246527870179d0,
     &      46.70253262446201d0, 46.27298600915950d0,
49.47234085283681d0,
     &      39.09822118183493d0, 50.60097055731093d0,
22.02181821840204d0,
     &      59.03751390981441d0, 14.78071089995543d0,
56.47728140297912d0,
     &      15.41701041857696d0, 56.64480495775947d0, 
8.867515403318820d0,
     &      43.75614165746457d0, 16.22538420841526d0,
39.28026424229725d0,
     &      20.20699581353119d0, 32.91704038300496d0,
23.25816962964250d0,
     &      28.98103359220141d0, 19.54110121548126d0,
29.12114520460265d0,
     &      18.19048659132261d0, 32.15731663808667d0, 
9.272518864050385d0,
     &      31.69099081800446d0, 
7.608951070603947d0,34.36364451158104d0,
     &       5.855965954856888d0,32.57072195069185d0, 
7.014869082921717d0,
     &      24.55455161653929d0, 
6.237724415349177d0,22.70307253746462d0,
     &      12.14026788997564d0, 15.38879387005048d0,
15.38532184891208d0,
     &      15.96424030181652d0, 11.49726582373110d0,
13.35549387284342d0,
     &      17.45042930575537d0, 14.49970176193603d0, 
6.118995861545767d0,
     &      16.32006280502381d0, 11.49765653210380d0,
19.25709570717501d0,
     &       8.995964400004252d0,21.18586024803900d0, 
7.686363131897639d0,
     &      14.21462486858620d0, 
4.894396406168025d0,16.95202666922457d0,
     &      12.13669169138723d0, 13.47330723950214d0,
10.39515415919642d0,
     &      14.75141661280306d0, 
9.347544171874434d0,10.78251856053053d0,
     &       6.124335331621731d0, 9.219637467708232d0,
5.285463022578457d0,
     &      16.69747522830103d0/
      pi=4.d0*datan(1.d0)
      z0=-35.0d0+dfloat(k-1)*0.05d0
      fz=a(1)/2
      do 10 j=2,100
   10 fz=fz+a(j)*dcos(dfloat(j-1)*pi*z0/35.0d0)
      return
      end

I have examined the source code with "od -tc" and find no spurious
characters anywhere near the apparent problem. If anyone can find the
syntax error, I'd like to hear from you!
	emil
      double precision function tryit(k)
      implicit double precision (a-h,o-z)
      dimension a(100)
      data (a(k),k=1,100)/
     &  461904.6285714286d0,-338522.8172195650d0,-134188.3826330945d0,
     & 1224917.281612405d0,  839777.8119190406d0, -14722.27542354662d0,
     &  -28752.76677743963d0, 17559.71526102492d0,  7531.385520293790d0,
     &   10162.59993007690d0,-59637.19030976763d0,-52592.20471033397d0,
     &   -1509.943936916021d0, 3429.465514693014d0,-1694.234343945828d0,
     &    -412.4642513588372d0,-771.8756555594653d0,5048.147334278087d0,
     &    5096.968116166064d0,  533.2677925364562d0, -84.36499146072562d0,
     &     349.7120367495403d0, 267.4315454437577d0, 213.0444007033096d0,
     &    -248.2444723301185d0,-313.9326637677008d0,  27.83649754041712d0,
     &     177.7370877639193d0,  12.32298112940429d0,133.6789475533487d0,
     &      18.64085535065390d0,152.7005644513549d0,  74.22321838037993d0,
     &     110.7911828183424d0,  33.51924585712681d0, 77.32667442499877d0,
     &      53.23602577975604d0, 57.18682258944803d0, 49.49246527870179d0,
     &      46.70253262446201d0, 46.27298600915950d0, 49.47234085283681d0,
     &      39.09822118183493d0, 50.60097055731093d0, 22.02181821840204d0,
     &      59.03751390981441d0, 14.78071089995543d0, 56.47728140297912d0,
     &      15.41701041857696d0, 56.64480495775947d0,  8.867515403318820d0,
     &      43.75614165746457d0, 16.22538420841526d0, 39.28026424229725d0,
     &      20.20699581353119d0, 32.91704038300496d0, 23.25816962964250d0,
     &      28.98103359220141d0, 19.54110121548126d0, 29.12114520460265d0,
     &      18.19048659132261d0, 32.15731663808667d0,  9.272518864050385d0,
     &      31.69099081800446d0,  7.608951070603947d0,34.36364451158104d0,
     &       5.855965954856888d0,32.57072195069185d0,  7.014869082921717d0,
     &      24.55455161653929d0,  6.237724415349177d0,22.70307253746462d0,
     &      12.14026788997564d0, 15.38879387005048d0, 15.38532184891208d0,
     &      15.96424030181652d0, 11.49726582373110d0, 13.35549387284342d0,
     &      17.45042930575537d0, 14.49970176193603d0,  6.118995861545767d0,
     &      16.32006280502381d0, 11.49765653210380d0, 19.25709570717501d0,
     &       8.995964400004252d0,21.18586024803900d0,  7.686363131897639d0,
     &      14.21462486858620d0,  4.894396406168025d0,16.95202666922457d0,
     &      12.13669169138723d0, 13.47330723950214d0, 10.39515415919642d0,
     &      14.75141661280306d0,  9.347544171874434d0,10.78251856053053d0,
     &       6.124335331621731d0, 9.219637467708232d0, 5.285463022578457d0,
     &      16.69747522830103d0/
      pi=4.d0*datan(1.d0)
      z0=-35.0d0+dfloat(k-1)*0.05d0
      fz=a(1)/2
      do 10 j=2,100
   10 fz=fz+a(j)*dcos(dfloat(j-1)*pi*z0/35.0d0)
      return
      end

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: possibly incorrect g77 syntax error message
  2000-05-26 11:22 possibly incorrect g77 syntax error message Emil Hallin
@ 2000-05-26 12:11 ` Emil Hallin
  2000-05-26 14:20 ` Toon Moene
  1 sibling, 0 replies; 3+ messages in thread
From: Emil Hallin @ 2000-05-26 12:11 UTC (permalink / raw)
  To: gcc

Sorry about a bogus posting. The line previous to the "syntax error" is
74 characters long. I don't know why I didn't count the line length
before embarrassing myself with that kind of rookie error!
	emil

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: possibly incorrect g77 syntax error message
  2000-05-26 11:22 possibly incorrect g77 syntax error message Emil Hallin
  2000-05-26 12:11 ` Emil Hallin
@ 2000-05-26 14:20 ` Toon Moene
  1 sibling, 0 replies; 3+ messages in thread
From: Toon Moene @ 2000-05-26 14:20 UTC (permalink / raw)
  To: Emil Hallin; +Cc: gcc

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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-05-26 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-26 11:22 possibly incorrect g77 syntax error message Emil Hallin
2000-05-26 12:11 ` Emil Hallin
2000-05-26 14:20 ` Toon Moene

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).