public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45674]  New: [OOP] Undefined references for extended types
@ 2010-09-14 23:49 dietmar dot ebner at gmail dot com
  2010-09-15 13:57 ` [Bug fortran/45674] " janus at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: dietmar dot ebner at gmail dot com @ 2010-09-14 23:49 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/45674] [OOP] Undefined references for extended types
  2010-09-14 23:49 [Bug fortran/45674] New: [OOP] Undefined references for extended types dietmar dot ebner at gmail dot com
@ 2010-09-15 13:57 ` janus at gcc dot gnu dot org
  2010-09-15 14:46 ` janus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-09-15 13:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from janus at gcc dot gnu dot org  2010-09-15 13:57 -------
Confirmed. From a quick glimpse it seems the patch goes in the right direction.
Will have a closer look soon.


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-09-15 13:57:41
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45674


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/45674] [OOP] Undefined references for extended types
  2010-09-14 23:49 [Bug fortran/45674] New: [OOP] Undefined references for extended types dietmar dot ebner at gmail dot com
  2010-09-15 13:57 ` [Bug fortran/45674] " janus at gcc dot gnu dot org
@ 2010-09-15 14:46 ` janus at gcc dot gnu dot org
  2010-09-15 15:36 ` dietmar dot ebner at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-09-15 14:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janus at gcc dot gnu dot org  2010-09-15 14:46 -------
(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.)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45674


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/45674] [OOP] Undefined references for extended types
  2010-09-14 23:49 [Bug fortran/45674] New: [OOP] Undefined references for extended types dietmar dot ebner at gmail dot com
  2010-09-15 13:57 ` [Bug fortran/45674] " janus at gcc dot gnu dot org
  2010-09-15 14:46 ` janus at gcc dot gnu dot org
@ 2010-09-15 15:36 ` dietmar dot ebner at gmail dot com
  2010-09-16  8:50 ` dominiq at lps dot ens dot fr
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dietmar dot ebner at gmail dot com @ 2010-09-15 15:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dietmar dot ebner at gmail dot com  2010-09-15 15:36 -------
(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!


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45674


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/45674] [OOP] Undefined references for extended types
  2010-09-14 23:49 [Bug fortran/45674] New: [OOP] Undefined references for extended types dietmar dot ebner at gmail dot com
                   ` (2 preceding siblings ...)
  2010-09-15 15:36 ` dietmar dot ebner at gmail dot com
@ 2010-09-16  8:50 ` dominiq at lps dot ens dot fr
  2010-09-16 12:11 ` janus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-09-16  8:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dominiq at lps dot ens dot fr  2010-09-16 08:50 -------
> (I have not regtested this yet.)

The (second) patch in comment #2 fixes the pr without regression.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45674


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/45674] [OOP] Undefined references for extended types
  2010-09-14 23:49 [Bug fortran/45674] New: [OOP] Undefined references for extended types dietmar dot ebner at gmail dot com
                   ` (3 preceding siblings ...)
  2010-09-16  8:50 ` dominiq at lps dot ens dot fr
@ 2010-09-16 12:11 ` janus at gcc dot gnu dot org
  2010-09-16 13:13 ` janus at gcc dot gnu dot org
  2010-09-16 13:14 ` janus at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-09-16 12:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from janus at gcc dot gnu dot org  2010-09-16 12:10 -------
(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.


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |janus at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-09-15 13:57:41         |2010-09-16 12:10:46
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45674


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/45674] [OOP] Undefined references for extended types
  2010-09-14 23:49 [Bug fortran/45674] New: [OOP] Undefined references for extended types dietmar dot ebner at gmail dot com
                   ` (4 preceding siblings ...)
  2010-09-16 12:11 ` janus at gcc dot gnu dot org
@ 2010-09-16 13:13 ` janus at gcc dot gnu dot org
  2010-09-16 13:14 ` janus at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-09-16 13:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from janus at gcc dot gnu dot org  2010-09-16 13:13 -------
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


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45674


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/45674] [OOP] Undefined references for extended types
  2010-09-14 23:49 [Bug fortran/45674] New: [OOP] Undefined references for extended types dietmar dot ebner at gmail dot com
                   ` (5 preceding siblings ...)
  2010-09-16 13:13 ` janus at gcc dot gnu dot org
@ 2010-09-16 13:14 ` janus at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-09-16 13:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from janus at gcc dot gnu dot org  2010-09-16 13:14 -------
Fixed with r164338. Closing.

Thanks for the report!


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45674


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-09-16 13:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-14 23:49 [Bug fortran/45674] New: [OOP] Undefined references for extended types dietmar dot ebner at gmail dot com
2010-09-15 13:57 ` [Bug fortran/45674] " janus at gcc dot gnu dot org
2010-09-15 14:46 ` janus at gcc dot gnu dot org
2010-09-15 15:36 ` dietmar dot ebner at gmail dot com
2010-09-16  8:50 ` dominiq at lps dot ens dot fr
2010-09-16 12:11 ` janus at gcc dot gnu dot org
2010-09-16 13:13 ` janus at gcc dot gnu dot org
2010-09-16 13:14 ` janus at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).