http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51055

             Bug #: 51055
           Summary: deferred length character allocation:
                    allocate(character(len=i)::s) rejected
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: j...@csc.fi


Hi,

I think the program below is valid, but rejected by gfortran 


program a
  character(len=:), allocatable :: s
  integer :: i=10
  allocate(character(len=i)::s)
end program a


gfortran -v -o s s.f90
Driving: gfortran -v -o s s.f90 -l gfortran -l m -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/wrk/jpr/gcc-4.7/bin/../libexec/gcc/i686-pc-linux-gnu/4.7.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --enable-languages=c,c++,fortran
--disable-bootstrap --prefix=/wrk/jpr/gcc-4.7 --with-gmp=/wrk/jpr/extralib
--with-mpfr=/wrk/jpr/extralib
Thread model: posix
gcc version 4.7.0 20110927 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-v' '-o' 's' '-shared-libgcc' '-mtune=generic'
'-march=pentiumpro'
 /home/wrk/jpr/gcc-4.7/bin/../libexec/gcc/i686-pc-linux-gnu/4.7.0/f951 s.f90
-quiet -dumpbase s.f90 -mtune=generic -march=pentiumpro -auxbase s -version
-fintrinsic-modules-path
/home/wrk/jpr/gcc-4.7/bin/../lib/gcc/i686-pc-linux-gnu/4.7.0/finclude -o
/tmp/cc1PUv7g.s
GNU Fortran (GCC) version 4.7.0 20110927 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 3.4.6 20060404 (Red Hat 3.4.6-11), GMP
version 4.3.1, MPFR version 2.4.1, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Fortran (GCC) version 4.7.0 20110927 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 3.4.6 20060404 (Red Hat 3.4.6-11), GMP
version 4.3.1, MPFR version 2.4.1, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
s.f90:4.25:

  allocate(character(len=i)::s)
                         1
Error: Variable 'i' cannot appear in the expression at (1)

Reply via email to