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

            Bug ID: 81027
           Summary: Assumed-shape array reported as deferred.
           Product: gcc
           Version: 6.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: john.harper at vuw dot ac.nz
  Target Milestone: ---

This program is bad because it has an assumed-shape array in an initialization
expression, but gfortran wrongly diagnoses it as a deferred array. Bug 46299
(in which gfortran accepted a bad program) may be related to this one, in which
a bad program was correctly rejected, but for the wrong reason. Here are the
program and what the compiler did with it.


cayley[~/Jfh] % cat badarray.f90
! is m assumed-shape or deferred-shape?
program badarray
  implicit none
  integer:: j(3) = [1,2,3]
  call doubling(j)
contains
  subroutine doubling(  n)
    integer,intent(in)::n(:)
    integer::m = size(n)
    print *, m
  end subroutine doubling
end program badarray


cayley[~/Jfh] % gfortran -v -std=f2003 badarray.f90
Driving: gfortran -v -std=f2003 badarray.f90 -l gfortran -l m -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --disable-multilib --disable-werror
--enable-checking=release
Thread model: posix
gcc version 6.3.1 20170109 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-std=f2003' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
 /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/f951 badarray.f90 -quiet -dumpbase
badarray.f90 -mtune=generic -march=x86-64 -auxbase badarray -std=f2003 -version
-fintrinsic-modules-path /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/finclude -o
/tmp/cctXeg2E.s
GNU Fortran (GCC) version 6.3.1 20170109 (x86_64-pc-linux-gnu)
        compiled by GNU C version 6.3.1 20170109, GMP version 6.1.2, MPFR
version 3.1.5-p2, MPC version 1.0.3, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran2003 (GCC) version 6.3.1 20170109 (x86_64-pc-linux-gnu)
        compiled by GNU C version 6.3.1 20170109, GMP version 6.1.2, MPFR
version 3.1.5-p2, MPC version 1.0.3, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
badarray.f90:9:22:

     integer::m = size(n)
                      1
Error: Deferred array ‘n’ at (1) is not permitted in an initialization
expression
badarray.f90:10:14:

     print *, m
              1
Error: Symbol ‘m’ at (1) has no IMPLICIT type
cayley[~/Jfh] %

Reply via email to