This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/57217] New: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 08 May 2013 17:32:51 +0000
- Subject: [Bug fortran/57217] New: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57217
Bug #: 57217
Summary: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP
overriding - lacking arguments check
Classification: Unclassified
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
CC: janus@gcc.gnu.org, salvatore.filippone@uniroma2.it
Reported by Salvatore; very vaguely related to PR47978.
In the following program, "clone" is overridden. The overridden procedure shall
use for the dummy arguments "CLASS(base_type)" instead of "CLASS(r_type)" as in
the original TBP - except for the PASS argument, which may be different.
GCC 4.6 prints:
procedure, pass(map) :: clone => r_clone
1
Error: Types mismatch for dummy argument 'mapout' of 'clone' (1) in respect to
the overridden procedure
F2008, "4.5.7.3 Type-bound procedure overriding":
"The overriding and overridden type-bound procedures shall satisfy the
following conditions.
[...] * Dummy arguments that correspond by position shall have the same names
and characteristics, except for the type of the passed-object dummy arguments."
module base_mod
type base_type
integer :: kind
contains
procedure, pass(map) :: clone => base_clone
end type base_type
contains
subroutine base_clone(map,mapout,info)
implicit none
class(base_type), intent(inout) :: map
class(base_type), intent(inout) :: mapout
integer :: info
end subroutine base_clone
end module base_mod
module r_mod
use base_mod
type, extends(base_type) :: r_type
real :: dat
contains
procedure, pass(map) :: clone => r_clone
end type r_type
contains
subroutine r_clone(map,mapout,info)
implicit none
class(r_type), intent(inout) :: map
class(r_type), intent(inout) :: mapout
integer :: info
end subroutine r_clone
end module r_mod