[Bug fortran/86408] New: [9 Regression] bogus error: ABSTRACT INTERFACE must not have an assumed character length result (F2003: C418)
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jul 5 07:51:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86408
Bug ID: 86408
Summary: [9 Regression] bogus error: ABSTRACT INTERFACE must
not have an assumed character length result (F2003:
C418)
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: janus at gcc dot gnu.org
Target Milestone: ---
Test case:
module m
implicit none
type, abstract :: t
contains
procedure(ifc), deferred :: tbf
procedure :: tbs
end type
abstract interface
function ifc(x) result(str)
import :: t
class(t) :: x
character(len=:), allocatable :: str
end function
end interface
contains
subroutine tbs(x)
class(t) :: x
print *, x%tbf()
end subroutine
end
This example (which I'd say is perfectly valid code), compiles well with
gfortran 8 (and ifort/pgfortran/flang), but is rejected by recent trunk builds
with:
function ifc(x) result(str)
1
Error: ABSTRACT INTERFACE ‘ifc’ at (1) must not have an assumed character
length result (F2003: C418)
This error is apparently bogus, primarily because 'str' is not assumed-length,
but deferred-length.
Moreover the error message does not really match the quoted standard clause
F03:C418, which says:
"A function name declared with an asterisk type-param-value shall not be an
array, a pointer, recursive, or pure."
1) This does not talk about abstract interfaces at all, but functions in
general.
2) The function in the examples has no asterisk type-param-value.
3) The function in the example is neither an array, pointer, recursive or pure.
More information about the Gcc-bugs
mailing list