This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/56814] [4.8/4.9 Regression] Bogus Interface mismatch in dummy procedure
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 03 Apr 2013 08:25:35 +0000
- Subject: [Bug fortran/56814] [4.8/4.9 Regression] Bogus Interface mismatch in dummy procedure
- Auto-submitted: auto-generated
- References: <bug-56814-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56814
--- Comment #3 from janus at gcc dot gnu.org 2013-04-03 08:25:35 UTC ---
(In reply to comment #1)
> The check is in interface.c's check_result_characteristics:
>
> /* Check PROCEDURE POINTER attribute. */
> if (r1 != s1 && r1->attr.proc_pointer != r2->attr.proc_pointer)
> {
> snprintf (errmsg, err_len, "PROCEDURE POINTER mismatch in "
> "function result");
>
> There are two things bogus here:
> a) Passing a proc-pointer to a non-pointer procedure dummy is valid
> b) There is no procedure(-pointer) function result, just a proc(-ptr)
> actual/dummy argument.
Right, but actually I think the above check should handle both of these points
correctly.
The problem rather seems to be that the symbol for 'f' does not have its result
field set up properly: It points to 'f' itself instead of 'd' (from the
interface).
The trivial fix is:
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 197388)
+++ gcc/fortran/resolve.c (working copy)
@@ -216,7 +216,7 @@ resolve_procedure_interface (gfc_symbol *sym)
if (ifc->result)
{
sym->ts = ifc->result->ts;
- sym->result = sym;
+ sym->result = ifc->result;
}
else
sym->ts = ifc->ts;
No idea how that got messed up. Will commit as obvious after regtesting.