This is most likely a follow-up on
module debug_m
implicit none
private
public :: debug_t, debug
type debug_t
logical :: trace
end type debug_t
type(debug_t), save :: debug
end module debug_m
module base_m
implicit none
private
public :: base_t
type, abstract :: base_t
contains
procedure(base_debug), deferred :: debug
end type base_t
abstract interface
subroutine base_debug(this)
import :: base_t
class(base_t), intent(in) :: this
end subroutine base_debug
end interface
end module base_m
module derived_m
use debug_m
use base_m
implicit none
private
public :: derived_t
type, extends(base_t) :: derived_t
contains
procedure :: debug => derived_debug
end type derived_t
contains
subroutine derived_debug(this)
class(derived_t), intent(in) :: this
end subroutine derived_debug
subroutine some_routine()
if (debug%trace) then
continue
end if
end subroutine some_routine
end module derived_m
The code above is a bit more verbose to keep it structured and readable. It is rejected by nvfortran with some weird error messages.
$ nvfortran --version
nvfortran 26.5-0 64-bit target on x86-64 Linux -tp icelake-server
NVIDIA Compilers and Tools
Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
$ nvfortran -c test.f90
NVFORTRAN-S-0155-Illegal context for the component reference to trace (test.f90: 50)
NVFORTRAN-F-0141-Derived Type object required on left of % (test.f90: 50)
NVFORTRAN/x86-64 Linux 26.5-0: compilation aborted
However, that code is accepted by other compilers, including NAG (known for its strict standard compliance) which only complains about unused variables and missing labels
$ nagfor -c test.f90
NAG Fortran Compiler Release 7.2(Shin-Urayasu) Build 7200
Warning: test.f90, line 47: Unused dummy variable THIS
Note: test.f90, line 51: CONTINUE statement with no label
[NAG Fortran Compiler normal termination, 2 warnings]