http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47583
Summary: Inquire affected by previous read Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: har...@klimachs.de Created attachment 23205 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23205 Minimal example The use of inquire seems to be affected by a previous read, in the same file, even if in a totally different scope. Attached is a minimal module illustrating this. There is a subroutine, reading some data unformatted, followed by another one which inquires the IO length of an array with intent(in). Compilation results in the following output: gfortran-mp-4.6 -v -save-temps -c testinquire.f90 Using built-in specs. COLLECT_GCC=gfortran-mp-4.6 COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin10/4.6.0/lto-wrapper Target: x86_64-apple-darwin10 Configured with: ../gcc-4.6-20110108/configure --prefix=/opt/local --build=x86_64-apple-darwin10 --libdir=/opt/local/lib/gcc46 --includedir=/opt/local/include/gcc46 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.6 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.6 --with-gxx-include-dir=/opt/local/include/gcc46/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --enable-stage1-checking --disable-multilib --enable-fully-dynamic-string --enable-languages=c,c++,objc,obj-c++,fortran Thread model: posix gcc version 4.6.0 20110108 (experimental) (GCC) COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.6.6' '-v' '-save-temps' '-c' '-mtune=core2' /opt/local/libexec/gcc/x86_64-apple-darwin10/4.6.0/f951 testinquire.f90 -fPIC -quiet -dumpbase testinquire.f90 -mmacosx-version-min=10.6.6 -mtune=core2 -auxbase testinquire -version -fintrinsic-modules-path /opt/local/lib/gcc46/gcc/x86_64-apple-darwin10/4.6.0/finclude -o testinquire.s GNU Fortran (GCC) version 4.6.0 20110108 (experimental) (x86_64-apple-darwin10) compiled by GNU C version 4.6.0 20110108 (experimental), GMP version 5.0.1, MPFR version 3.0.0-p8, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU Fortran (GCC) version 4.6.0 20110108 (experimental) (x86_64-apple-darwin10) compiled by GNU C version 4.6.0 20110108 (experimental), GMP version 5.0.1, MPFR version 3.0.0-p8, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 testinquire.f90:20.25: inquire(iolength=rl) sizedat 1 Error: Dummy argument 'sizedat' with INTENT(IN) in variable definition context (item in READ) at (1) If the order of the subroutines is changed, that is, if the read appears after the inquire statement, the code is compiled as expected. At least in gfortran 4.4 this issue was not present.