This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/45674] New: [OOP] Undefined references for extended types


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]