Home > Archive > Fortran > February 2007 > READ error with Gfortran
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
READ error with Gfortran
|
|
|
| Hello everyone !
I recently tried to switch compilers on a F90 code that compiled and
executed great with the INTEL FORTRAN compiler (IFORT). However, when
i try to compile the same on a Ubuntu machine with GFORTRAN - strange
errors started cropping up ... :-( Any help/hints would be really
great..
The error is:
++++++++++++++++++++++++++++++++++++++++
++++++++++=
In file breader.f90:12
read(12,*) (tissid(i)),(sge(i,1)),(sge(i,2))
1
Error: Expected variable in READ statement at (1)
++++++++++++++++++++++++++++++++++++++++
++++++++++
The code snippet is:
=======================================
open(unit=12,file='sgepslookup.txt',status='old')
do 1 i=1,size(tissid)
read(12,*) (tissid(i)),(sge(i,1)),(sge(i,2))
1 enddo
=======================================
The file being read is an ASCII file with one INTEGER and two real
values per line that are to be read sequentially...
Thanks everyone !
-A
| |
| Thomas Koenig 2007-02-19, 7:05 pm |
| Ash <ashutosh.mishra@gmail.com> wrote:
> ++++++++++++++++++++++++++++++++++++++++
++++++++++=
>In file breader.f90:12
>
> read(12,*) (tissid(i)),(sge(i,1)),(sge(i,2))
> 1
>Error: Expected variable in READ statement at (1)
This is indeed a syntax error. (tsssid(i)) is an expression,
not a variable (just as tssid(i)+0 would be). You are trying to
read something into that expression, and gfortran is telling you
it expects a variable instead.
You probably want to use
read(12,*) tissid(i),sge(i,1),sge(i,2)
I have no idea why ifort accepts this, it's probably a bug.
| |
| glen herrmannsfeldt 2007-02-19, 7:05 pm |
| Thomas Koenig wrote:
(snip)
[color=darkred]
> I have no idea why ifort accepts this, it's probably a bug.
Probably because it is needed for implied DO's. ifort then
isn't bothered by the fact that there isn't an implied DO.
-- glen
| |
|
| On Feb 19, 3:25 pm, Thomas Koenig <Thomas.Koe...@online.de> wrote:
> Ash <ashutosh.mis...@gmail.com> wrote:
>
>
> This is indeed a syntax error. (tsssid(i)) is an expression,
> not a variable (just as tssid(i)+0 would be). You are trying to
> read something into that expression, and gfortran is telling you
> it expects a variable instead.
>
> You probably want to use
>
> read(12,*) tissid(i),sge(i,1),sge(i,2)
>
> I have no idea why ifort accepts this, it's probably a bug.
Thanks ! That DID do the trick !
Strange about the Ifort ..hmm..
Cheers,
-A
|
|
|
|
|