Current mainline gfortran rejects the following code: program test type foo integer size real,pointer,dimension(:) :: vals end type
type(foo) var1 var1%size=5 allocate(var1%vals(var1%size)) end program ~/tmp>gfortran -v test.f90 Driving: gfortran -v test.f90 -lgfortranbegin -lgfortran -lm -shared-libgcc Using built-in specs. Target: i686-pc-linux-gnu Configured with: /scratch/gcc/configure --prefix=/afs/mpa/data/martin/ugcc --enable-languages=c++,fortran --with-gmp=/afs/mpa/data/martin/mygmp --with-mpfr=/afs/mpa/data/martin/mympfr --without-makeinfo --disable-tls Thread model: posix gcc version 4.2.0 20061004 (experimental) /afs/mpa/data/martin/ugcc/libexec/gcc/i686-pc-linux-gnu/4.2.0/f951 test.f90 -quiet -dumpbase test.f90 -mtune=generic -auxbase test -version -I /afs/mpa/data/martin/ugcc/lib/gcc/i686-pc-linux-gnu/4.2.0/finclude -o /tmp/ccL7Uf1l.s GNU F95 version 4.2.0 20061004 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 4.2.0 20061004 (experimental). GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 In file test.f90:9 allocate(var1%vals(var1%size)) 1 Error: 'var1' must not appear an the array specification at (1) in the same ALLOCATE statement where it is itself allocated The code is accepted by current gfortran 4.1 and by 4.2 a few days ago. AFAICT it is valid Fortran. -- Summary: [gfortran,4.2.0 regression] valid ALLOCATE-statement rejected Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: martin at mpa-garching dot mpg dot de GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29344