https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82419
Bug ID: 82419
Summary: Error: Expected variable in READ statement in (1)
Product: gcc
Version: 6.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: jz2596 at columbia dot edu
Target Milestone: ---
- I find this error trying to compile a fortran code in version 6.3.0 The
details on the compiler are:
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/gfortran/libexec/gcc/x86_64-apple-darwin16/6.3.0/lto-wrapper
Target: x86_64-apple-darwin16
Configured with: ../gcc-6.3.0/configure --prefix=/usr/local/gfortran
--enable-languages=c,c++,fortran,objc,obj-c++ --build=x86_64-apple-darwin16
--with-gmp=/Users/fx/devel/gcc/deps-static/x86_64
--with-mpfr=/Users/fx/devel/gcc/deps-static/x86_64
--with-mpc=/Users/fx/devel/gcc/deps-static/x86_64
--with-isl=/Users/fx/devel/gcc/deps-static/x86_64
Thread model: posix
gcc version 6.3.0 (GCC)
- The compiler error is:
gfortran -g -Wall -I../FFTW/api -I../mod -L../FFTW -L../lib -lutils -lfftw3
-c utils.f90
utils.f90:251:12:
read(20,*) ((dat(1:cn,n)),n=1,ln)
1
Error: Expected variable in READ statement at (1)
utils.f90:299:12:
- The code that seems to generate the error is
subroutine loadtxt_1d_c(f,dat,usecols,fsize,debug)
implicit none
!I/O
logical ,intent(in), optional :: debug
integer, intent(in), optional :: usecols(:), fsize(1:2)
character(*), intent(in) :: f
complex(dlc), intent(out) :: dat(:)
!internal
integer :: n, cn, ln
double precision, allocatable :: rdat(:,:)
complex(dlc) :: r
open(unit=20,file=trim(f),status='old')
if (present(fsize)) then !faster if cn is given
cn = fsize(1)
ln = fsize(2)
else
cn = filecolumns(20)
ln = filelines(20)
write(*,*) 'file size is', cn, ln
end if
allocate(rdat(cn,ln))
if (present(debug)) write(*,*) 'reading', trim(f)
read(20,*) ((rdat(1:cn,n)),n=1,ln)
dat = rdat(1,:) + iu*rdat(2,:)
close(20)
deallocate(rdat)
end subroutine loadtxt_1d_c
There are other instances of this error in similar read statements in other
subroutines. This code compiles on a different machine using ifort, I am trying
to have it run on a mac laptop. I found a similar error report Bug 39953 -
Error: Expected VARIABLE at (1), and it seems it was fixed in version 4.2.1 and
later.
Any ideas would be greatly appreciated!
Best regards,
Jose