From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26972 invoked by alias); 14 Sep 2010 23:49:05 -0000 Received: (qmail 26912 invoked by uid 48); 14 Sep 2010 23:48:54 -0000 Date: Tue, 14 Sep 2010 23:49:00 -0000 Subject: [Bug fortran/45674] New: [OOP] Undefined references for extended types X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "dietmar dot ebner at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-09/txt/msg01679.txt.bz2 The testcase below leads to the following linker error on current trunk, gcc 4.5.0 and gcc 4.5.1: $gfortran fails.f90 /tmp/ccG09ce7.o: In function `__fails_test_MOD_bar': fails.f90:(.text+0xe): undefined reference to `vtab$b_t.1500' collect2: ld returned 1 exit status The patch at the end of the bug report seems to solve the problem for me but it's mainly a wild guess. The issue seems to be closely related to 44065. file fails.f90 =================================================================== module fails_mod implicit none type :: a_t integer :: a end type type, extends(a_t) :: b_t integer :: b end type contains subroutine foo(a) class(a_t) :: a end subroutine foo end module fails_mod module fails_test implicit none contains subroutine bar use fails_mod type(b_t) :: b call foo(b) end subroutine bar end module fails_test end 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) { -- Summary: [OOP] Undefined references for extended types Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dietmar dot ebner at gmail dot com GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45674