This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Fortran 77 code and Data statements...
- To: Emily <eglass at cae dot ca>
- Subject: Re: Fortran 77 code and Data statements...
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: Mon, 19 Jun 2000 22:34:37 +0200
- CC: gcc at gcc dot gnu dot org
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <394E7258.3977A19A@cae.ca>
Emily wrote:
> I am trying to port some old fortran code to linux from AIX. The code
> compiled without errors in AIX with xlf. However, in linux, g77 seems
> to dislike the array-initializing DATA statements. Here is a small
> sample program I wrote:
> INTEGER*2
> & ELEPHANT(3,10,27),
> & I, J, K
> DATA ((ELEPHANT(1,I,25),I=1,3) /3 * 23/
^ Note: this parenthesis is wrong (or the next one)
> DATA ((ELEPHANT(2,J,K),J=1,2),K=26,27) /4 * 34/
> ELEPHANT(2,1,3) = 4
> DO 15 K=7,10
> DO 20 L=1,3
> ELEPHANT(2,K,L) = 9888
> 20 CONTINUE
> 15 CONTINUE
>
> END
>
> And these are the error mesages i get when i compile my file (tutu.f)
> with g77 and NO options:
>
> > g77 tutu.f
> tutu.f: In program `MAIN__':
> tutu.f:5:
> DATA ((ELEPHANT(1,I,25),I=1,3) /3 * 23/
> ^
This is a shortcoming in g77 of the treatment of the non-Standard
INTEGER*2 declaration in the first couple of lines of your program (not
so much the declaration of ELEPHANT, but of I, J and K).
If you replace the first few lines of the program by:
INTEGER*2
& ELEPHANT(3,10,27)
INTEGER
& I, J, K
and remove the superfluous parenthesis, it will compile (I suppose it
doesn't really harm to have the index variables I, J and K be plain
INTEGERs).
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)