From: Janus Weil Date: Sun, 16 Sep 2018 19:57:52 +0000 (+0200) Subject: fix PR 86484 and PR 84543 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=74b08343dab5369d2229e52c7c2d2056378cbe4e;p=gcc.git fix PR 86484 and PR 84543 2018-09-16 Janus Weil PR fortran/86484 PR fortran/84543 * match.c (gfc_match_assignment): For a polymorphic assignment, make sure that the vtab for the rhs type is generated. 2018-09-16 Janus Weil PR fortran/86484 PR fortran/84543 * gfortran.dg/class_assign_2.f90: New test case. * gfortran.dg/class_assign_3.f90: New test case. From-SVN: r264350 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 6f4872e65d6..4c6c2445d1a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2018-09-16 Janus Weil + + PR fortran/86484 + PR fortran/84543 + * match.c (gfc_match_assignment): For a polymorphic assignment, + make sure that the vtab for the rhs type is generated. + 2018-09-16 Thomas Koenig PR fortran/37802 diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 85247dd8334..badd3c4a5de 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -1366,6 +1366,9 @@ gfc_match_assignment (void) gfc_check_do_variable (lvalue->symtree); + if (lvalue->ts.type == BT_CLASS) + gfc_find_vtab (&rvalue->ts); + return MATCH_YES; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e37c1773bff..79ecbb7f61a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2018-09-16 Janus Weil + + PR fortran/86484 + PR fortran/84543 + * gfortran.dg/class_assign_2.f90: New test case. + * gfortran.dg/class_assign_3.f90: New test case. + 2018-09-16 Thomas Koenig PR fortran/37802 diff --git a/gcc/testsuite/gfortran.dg/class_assign_2.f90 b/gcc/testsuite/gfortran.dg/class_assign_2.f90 new file mode 100644 index 00000000000..3b8db4adebd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_assign_2.f90 @@ -0,0 +1,22 @@ +! { dg-do link } +! +! PR 86484:[OOP] Undefined symbol when using polymorphic intrinsic assignment +! +! Contributed by Rich Townsend + +program test_assign + + implicit none + + type :: foo_t + end type + + type, extends (foo_t) :: bar_t + end type + + class(foo_t), allocatable :: f + type(bar_t) :: b + + f = b + +end diff --git a/gcc/testsuite/gfortran.dg/class_assign_3.f90 b/gcc/testsuite/gfortran.dg/class_assign_3.f90 new file mode 100644 index 00000000000..e51651e6af0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_assign_3.f90 @@ -0,0 +1,9 @@ +! { dg-do link } +! +! PR 84543: undefined reference to __copy_INTEGER_4_.3788 +! +! Contributed by Neil Carlson + +class(*), allocatable :: x +x = 42 +end