https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93422
Bug ID: 93422 Summary: Bogus POINTER attribute mismatch with submodule MODULE PROCEDURE Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: abensonca at gmail dot com Target Milestone: --- The following code results in a bogus error (using git commit 472dc648ce3e7661762931d584d239611ddca964) claiming a pointer attribute mismatch between the function result as defined in the module and submodule: module t type :: a contains procedure :: p => ap end type a type, extends(a) :: b contains procedure :: p => bp end type b type :: c end type c type, extends(c) :: d end type d interface module function bp(s) class(b), intent(inout) :: s class(d), pointer :: bp end function end interface contains function ap(s) class(a), intent(inout) :: s class(d), pointer :: ap end function ap end module t submodule (t) ts contains function bp(s) class(d), pointer :: bp class(b), intent(inout) :: s end function bp end submodule ts $ gfortran -v Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/home/abenson/Galacticus/Tools/libexec/gcc/x86_64-pc-linux-gnu/10.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-git/configure --prefix=/home/abenson/Galacticus/Tools --enable-languages=c,c++,fortran --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.0.1 20200124 (experimental) (GCC) $ gfortran -c test4.mod.F90 -o test4.mod.o test4.mod.F90:35:12: 35 | submodule (t) ts | 1 Error: Result mismatch for the overriding procedure 'p' at (1): POINTER attribute mismatch in function result test4.mod.F90:39:2: 39 | function bp(s) | 1 Error: POINTER attribute mismatch in function result between the MODULE PROCEDURE declaration in MODULE 't' and the declaration at (1) in (SUB)MODULE 'ts' The code compiles successfully if the "pointer" attribute is removed, or if the function in the submodule is declared using the "module procedure" approach instead of explicitly (re)defining its interface. It also compiles successfully using ifort 18.0.1.