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

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2010-11-05 
08:59:14 UTC ---
> The program is invalid without "import func_interface".
> 
> The reason is that not the interface block but the interface body is a scoping
> unit and host association only occurs using the IMPORT statement.
> 
> While many compilers (crayftn, nagf95, xlf, g95) correctly reject the program,
> gfortran happily compiles it.

With an unpatched trunk, I get an error in both cases:

[macbook] f90/bug% gfcp -v
Using built-in specs.
COLLECT_GCC=gfcp
COLLECT_LTO_WRAPPER=/opt/gcc/gcc4.6p/libexec/gcc/x86_64-apple-darwin10/4.6.0/lto-wrapper
Target: x86_64-apple-darwin10
Configured with: ../p_work/configure --prefix=/opt/gcc/gcc4.6p
--mandir=/opt/gcc/gcc4.6p/share/man --infodir=/opt/gcc/gcc4.6p/share/info
--build=x86_64-apple-darwin10 --host=x86_64-apple-darwin10
--target=x86_64-apple-darwin10 --enable-languages=c,lto,fortran
--with-gmp=/opt/sw64 --with-libiconv-prefix=/opt/sw64 --with-system-zlib
--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib
--with-cloog=/opt/sw64 --with-ppl=/opt/sw64 --with-mpc=/opt/sw64
--enable-checking=release
Thread model: posix
gcc version 4.6.0 20101031 (experimental) [trunk revision 166102] (GCC) 
[macbook] f90/bug% gfcp pr46310.f90
pr46310.f90:6.29:

   subroutine bar_interface(f)
                             1
Error: PROCEDURE attribute conflicts with INTENT attribute in 'f' at (1)
[macbook] f90/bug% gfcp pr46310_db.f90
pr46310_db.f90:6.29:

   subroutine bar_interface(f)
                             1
Error: PROCEDURE attribute conflicts with INTENT attribute in 'f' at (1)
[macbook] f90/bug% diff -up pr46310.f90 pr46310_db.f90
--- pr46310.f90    2010-11-05 09:51:53.000000000 +0100
+++ pr46310_db.f90    2010-11-05 09:53:55.000000000 +0100
@@ -4,6 +4,7 @@ module foo_module
    real function func_interface()
    end function
    subroutine bar_interface(f)
+     import func_interface
      implicit none
      procedure(func_interface), intent(in) :: f
    end subroutine

Reply via email to