[Bug fortran/77903] [F08] gfortran 6.1.0/7.0.0 accept invalid code with conflicting module/submodule interfaces
pault at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Nov 27 19:00:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77903
--- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Damian Rouson from comment #0)
> Gfortran accepts invalid code in which an implicitly typed interface body
> has the same name as a conflicting, explicitly typed module function
> implemented in a submodule. See below.
>
> Damian
>
>
> $ cat one.f90
> module one_module
> implicit none
> interface
> module function one()
> end function
> end interface
> end module
>
> submodule(one_module) one_submodule
> implicit none
> contains
> integer module function one()
> one = 1
> end function
> end submodule
>
> use one_module
> print *,one()," is not ",1
> end
>
> $ gfortran -std=f2008 -Wall -fcheck=all one.f90
>
> $ ./a.out
> 9.18340949E-41 is not 1
>
> $ gfortran --version
> GNU Fortran (MacPorts gcc6 6.1.0_0) 6.1.0
Interestingly, ifort accepts this and imposes the interface definition to the
extent of making the type conversion.
I will have to dwell some more on this.
Paul
More information about the Gcc-bugs
mailing list