https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82419

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |kargl at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #1 from kargl at gcc dot gnu.org ---
(In reply to J Zorrilla from comment #0)
> - 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
> 

First, the code you submitted is not self contained, so raises
a number of errors.

Second, gfortran is correct.  You have

read(20,*) ((rdat(1:cn,n)),n=1,ln)

which has () around the rdat(1:cn,n).  That is, (rdat(1:cn,n))
is an expression.

Reply via email to