Summary: | [OOP] Undefined references for extended types | ||
---|---|---|---|
Product: | gcc | Reporter: | Dietmar Ebner <dietmar.ebner> |
Component: | fortran | Assignee: | janus |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | gcc-bugs, janus |
Priority: | P3 | ||
Version: | 4.6.0 | ||
Target Milestone: | 4.6.0 | ||
Host: | i686-pc-linux-gnu | Target: | i686-pc-linux-gnu |
Build: | i686-pc-linux-gnu | Known to work: | |
Known to fail: | Last reconfirmed: | 2010-09-16 12:10:46 |
Description
Dietmar Ebner
2010-09-14 23:48:54 UTC
Confirmed. From a quick glimpse it seems the patch goes in the right direction. Will have a closer look soon. (In reply to comment #0) > Index: fortran/interface.c > =================================================================== > --- fortran/interface.c (revision 164288) > +++ fortran/interface.c (working copy) > @@ -1428,10 +1428,12 @@ > && actual->ts.u.derived && actual->ts.u.derived->ts.is_iso_c) > return 1; > > - if (formal->ts.type == BT_CLASS) > + if (formal->ts.type == BT_CLASS) { > /* Make sure the vtab symbol is present when > the module variables are generated. */ > gfc_find_derived_vtab (formal->ts.u.derived); > + gfc_find_derived_vtab (actual->ts.u.derived); > + } > > if (actual->ts.type == BT_PROCEDURE) > { > Actually I think this patch is ok. Are you interested in committing it yourself? [Note that you'll need an FSF copyright assignment, if you don't already have one.] Otherwise I can commit it for you. Side note: One can (should) extend the patch in the following way ... Index: gcc/fortran/interface.c =================================================================== --- gcc/fortran/interface.c (revision 164304) +++ gcc/fortran/interface.c (working copy) @@ -1428,10 +1428,10 @@ compare_parameter (gfc_symbol *formal, gfc_expr *a && actual->ts.u.derived && actual->ts.u.derived->ts.is_iso_c) return 1; - if (formal->ts.type == BT_CLASS) + if (formal->ts.type == BT_CLASS && actual->ts.type == BT_DERIVED) /* Make sure the vtab symbol is present when the module variables are generated. */ - gfc_find_derived_vtab (formal->ts.u.derived); + gfc_find_derived_vtab (actual->ts.u.derived); if (actual->ts.type == BT_PROCEDURE) { (I have not regtested this yet.) (In reply to comment #2) > Actually I think this patch is ok. Are you interested in committing it > yourself? [Note that you'll need an FSF copyright assignment, if you don't > already have one.] Otherwise I can commit it for you. I don't have the copyright assignment in place so please go ahead and do it. Thanks for the quick fix! > (I have not regtested this yet.) The (second) patch in comment #2 fixes the pr without regression. (In reply to comment #3) > Thanks for the quick fix! Well, it was *your* fix, so *I* should thank *you* :) Anyway, I think the patch in comment #2 qualifies as obvious, and has no regressions, as noted by Dominique. Will commit soon. Subject: Bug 45674 Author: janus Date: Thu Sep 16 13:12:59 2010 New Revision: 164338 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164338 Log: 2010-09-16 Janus Weil <janus@gcc.gnu.org> PR fortran/45674 * interface.c (compare_parameter): Create vtab for actual argument, instead of formal (if needed). 2010-09-16 Janus Weil <janus@gcc.gnu.org> PR fortran/45674 * gfortran.dg/class_dummy_2.f03: New. Added: trunk/gcc/testsuite/gfortran.dg/class_dummy_2.f03 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/interface.c trunk/gcc/testsuite/ChangeLog |