This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/57217] [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: Thu, 09 May 2013 09:55:30 +0000
- Subject: [Bug fortran/57217] [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check
- Auto-submitted: auto-generated
- References: <bug-57217-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57217
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-05-09 09:55:30 UTC ---
The problem is that gfc_check_typebound_override calls
check_dummy_characteristics -> compare_type_rank -> gfc_compare_types
But the latter accepts a type extension, which means that one has to also check
the reverse.
Patch:
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -4130,2 +4130,13 @@ gfc_check_typebound_override (gfc_symtree* proc,
gfc_symtree* old)
check_type = proc_pass_arg != argpos && old_pass_arg != argpos;
+ if (check_type
+ && (!gfc_compare_types (&proc_formal->sym->ts, &old_formal->sym->ts)
+ || !gfc_compare_types (&old_formal->sym->ts,
+ &proc_formal->sym->ts)))
+ {
+ gfc_error ("Argument type mismatch for the overriding procedure "
+ "'%s' at %L: %s vs %s", proc->name, &where,
+ gfc_typename (&proc_formal->sym->ts),
+ gfc_typename (&old_formal->sym->ts));
+ return false;
+ }
if (!check_dummy_characteristics (proc_formal->sym, old_formal->sym,