From 63631f7d15d7b774935a27e0d87b5ee71fbd9630 Mon Sep 17 00:00:00 2001 From: Andre Vehreschild Date: Mon, 13 Jul 2015 11:01:54 +0200 Subject: [PATCH] re PR fortran/64589 ([OOP] Linking error due to undefined integer symbol with unlimited polymorphism) gcc/testsuite/ChangeLog: 2015-07-13 Andre Vehreschild PR fortran/64589 * gfortran.dg/pr64589.f90: New test. gcc/fortran/ChangeLog: 2015-07-13 Andre Vehreschild PR fortran/64589 * class.c (find_intrinsic_vtab): Put/Search vtabs for intrinsic types in the top-level namespace. From-SVN: r225730 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/class.c | 6 ++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr64589.f90 | 30 +++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr64589.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 6fad33241df..0a2734b6695 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2015-07-13 Andre Vehreschild + + PR fortran/64589 + * class.c (find_intrinsic_vtab): Put/Search vtabs for intrinsic + types in the top-level namespace. + 2015-07-12 Aldy Hernandez * trans-stmt.c: Fix double word typos. diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index 799039999db..218973dc048 100644 --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -2511,10 +2511,8 @@ find_intrinsic_vtab (gfc_typespec *ts) sprintf (name, "__vtab_%s", tname); - /* Look for the vtab symbol in various namespaces. */ - gfc_find_symbol (name, gfc_current_ns, 0, &vtab); - if (vtab == NULL) - gfc_find_symbol (name, ns, 0, &vtab); + /* Look for the vtab symbol in the top-level namespace only. */ + gfc_find_symbol (name, ns, 0, &vtab); if (vtab == NULL) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1e6a07186d6..46cf748e298 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-07-13 Andre Vehreschild + + PR fortran/64589 + * gfortran.dg/pr64589.f90: New test. + 2015-07-13 Renlin Li PR rtl/66556 diff --git a/gcc/testsuite/gfortran.dg/pr64589.f90 b/gcc/testsuite/gfortran.dg/pr64589.f90 new file mode 100644 index 00000000000..6e65e70aa03 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr64589.f90 @@ -0,0 +1,30 @@ +! { dg-do compile } +! Just need to check if compiling and linking is possible. +! +! Check that the _vtab linking issue is resolved. +! Contributed by Damian Rouson + +module m +contains + subroutine fmt() + class(*), pointer :: arg + select type (arg) + type is (integer) + end select + end subroutine +end module + +program p + call getSuffix() +contains + subroutine makeString(arg1) + class(*) :: arg1 + select type (arg1) + type is (integer) + end select + end subroutine + subroutine getSuffix() + call makeString(1) + end subroutine +end + -- 2.30.2