Attempting to compile the following code: module dealloc_test implicit none
type test_type integer, dimension(:), allocatable :: array integer :: st end type test_type contains subroutine test type(test_type) :: foo deallocate(foo%array, stat=foo%st) end subroutine test end module dealloc_test generates the following result: [jh...@jhogg] ~/src/ma77_ic$ gfortran-4.5 -c temp.f90 temp.f90:13.33: deallocate(foo%array, stat=foo%st) 1 Error: Stat-variable at (1) shall not be DEALLOCATEd within the same DEALLOCATE statement This seems to be legal code to me, and is used throughout our Fortran library. Version information (debian expt package): [jh...@jhogg] ~/src/ma77_ic$ gfortran-4.5 -v Using built-in specs. COLLECT_GCC=gfortran-4.5 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.5.1/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.5.0-5' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++,java,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 --program-suffix=-4.5 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --with-plugin-ld=ld.gold --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.5/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.5 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.5 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --with-arch-32=i486 --with-tune=generic --enable-checking=yes --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.5.1 20100602 (prerelease) (Debian 4.5.0-5) Thanks, Jonathan -- Summary: incorrect error: Stat-variable at (1) shall not be DEALLOCATEd within the same DEALLOCATE statement Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jonathan dot hogg at stfc dot ac dot uk GCC host triplet: x86_64-linux-gnu GCC target triplet: x86_64-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44556