module usage and interfaces, bug?

Daniel Franke franke.daniel@gmail.com
Mon Jan 15 20:21:00 GMT 2007


On Monday 15 January 2007 19:53, Andrea Ferretti wrote:
> gfortran seems not able to compile the following chain files, which I
> think should be compliant with the standard (at least as far as I know).
> Thanks in advance for the help.

> the compilation stops with a failure when compiling main.f90
> giving the error:
>
> Name 'hello' at (1) is an ambiguous reference to 'hello' from module
> 'interf_module'

Andrea,

Paul Thomas recently spent quite some time fixing loads of interface-related 
bugs (see meta-bug PR29670), therefore gfortran's handling of some code may 
have changed. 

Here's another example which is reported as erronuous:
$> cat iface.f90
MODULE mod_foo
INTERFACE
  FUNCTION foo()
    INTEGER :: foo
  END FUNCTION
END INTERFACE
END MODULE

function foo()
  USE mod_foo
  INTEGER :: foo
  foo = 42
END function

$> gfortran-svn -c -g -Wall -Wimplicit-interface -fimplicit-none iface.f90
iface.f90:12.16:

  INTEGER :: foo
               1
Error: Name 'foo' at (1) is an ambiguous reference to 'foo' from current 
program unit
iface.f90:13.5:

  foo = 42
    1
Error: Name 'foo' at (1) is an ambiguous reference to 'foo' from current 
program unit
iface.f90:10.12:

function foo()
           1
Error: Function 'foo' at (1) has no IMPLICIT type


The Intel and Lahey compilers report similar issues, SUN accepts it (but gives 
a unrelated message if compiled with -ansi enabled).

Thus I assume gfortran's behaviour to be correct.

Regards
	Daniel



More information about the Fortran mailing list