https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97122
Bug ID: 97122 Summary: Spurious FINAL ... must be in the specification part of a MODULE Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: ian_harvey at bigpond dot com Target Milestone: --- When compiling the following, recent master (and 10.2.1) issues an error Error: Derived type declaration with FINAL at (1) must be in the specification part of a MODULE There is no such requirement in the language. MODULE m IMPLICIT NONE INTERFACE MODULE SUBROUTINE other IMPLICIT NONE END SUBROUTINE other END INTERFACE END MODULE m SUBMODULE (m) s IMPLICIT NONE TYPE :: t CONTAINS FINAL :: p END TYPE t CONTAINS SUBROUTINE p(arg) TYPE(t), INTENT(INOUT) :: arg END SUBROUTINE p MODULE SUBROUTINE other END SUBROUTINE other END SUBMODULE s ]$ gfortran -v -c 2020-09-20\ final.f90 Using built-in specs. COLLECT_GCC=gfortran Target: x86_64-pc-linux-gnu Configured with: .././src/configure --prefix=/home/MEGMS2/ian/usr/gcc-11.0.0 --enable-languages=c,c++,fortran,lto --enable-libgomp --enable-checking=release --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.0.0 20200919 (experimental) (GCC) COLLECT_GCC_OPTIONS='-v' '-c' '-mtune=generic' '-march=x86-64' /home/MEGMS2/ian/usr/gcc-11.0.0/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/f951 2020-09-20 final.f90 -quiet -dumpbase 2020-09-20 final.f90 -dumpbase-ext .f90 -mtune=generic -march=x86-64 -version -fintrinsic-modules-path /home/MEGMS2/ian/usr/gcc-11.0.0/lib/gcc/x86_64-pc-linux-gnu/11.0.0/finclude -fpre-include=/usr/include/finclude/math-vector-fortran.h -o /tmp/ccPu3yxp.s GNU Fortran (GCC) version 11.0.0 20200919 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 11.0.0 20200919 (experimental), GMP version 6.1.2, MPFR version 4.0.2-p9, MPC version 1.1.0, isl version isl-0.16.1-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU Fortran2008 (GCC) version 11.0.0 20200919 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 11.0.0 20200919 (experimental), GMP version 6.1.2, MPFR version 4.0.2-p9, MPC version 1.1.0, isl version isl-0.16.1-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 2020-09-20 final.f90:14:10: 14 | FINAL :: p | 1 Error: Derived type declaration with FINAL at (1) must be in the specification part of a MODULE