From 477f145b5798e5a8f0766aaa1f0fb0ca2dcd9abd Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Mon, 22 May 2017 19:08:24 +0200 Subject: [PATCH] re PR fortran/80766 ([OOP] ICE with type-bound procedure returning an array) 2017-05-22 Janus Weil PR fortran/80766 * resolve.c (resolve_fl_derived): Make sure that vtype symbols are properly resolved. 2017-05-22 Janus Weil PR fortran/80766 * gfortran.dg/typebound_call_28.f90: New test. From-SVN: r248341 --- gcc/fortran/ChangeLog | 6 +++ gcc/fortran/resolve.c | 2 + gcc/testsuite/ChangeLog | 5 +++ .../gfortran.dg/typebound_call_28.f90 | 37 +++++++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/typebound_call_28.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 76418d94948..6977bd1372a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2017-05-22 Janus Weil + + PR fortran/80766 + * resolve.c (resolve_fl_derived): Make sure that vtype symbols are + properly resolved. + 2017-05-19 Paul Thomas PR fortran/80333 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index d50ffdb826a..a5f4874d513 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -13832,6 +13832,8 @@ resolve_fl_derived (gfc_symbol *sym) gfc_symbol *vtab = gfc_find_derived_vtab (data->ts.u.derived); gcc_assert (vtab); vptr->ts.u.derived = vtab->ts.u.derived; + if (!resolve_fl_derived0 (vptr->ts.u.derived)) + return false; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e162c862e43..d9a1e1c264d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-05-22 Janus Weil + + PR fortran/80766 + * gfortran.dg/typebound_call_28.f90: New test. + 2017-05-22 Nathan Sidwell * g++.dg/lookup/strong-using.C: New. diff --git a/gcc/testsuite/gfortran.dg/typebound_call_28.f90 b/gcc/testsuite/gfortran.dg/typebound_call_28.f90 new file mode 100644 index 00000000000..376c4c4f9ce --- /dev/null +++ b/gcc/testsuite/gfortran.dg/typebound_call_28.f90 @@ -0,0 +1,37 @@ +! { dg-do compile } +! +! PR 80766: [7/8 Regression] [OOP] ICE with type-bound procedure returning an array +! +! Contributed by Vladimir Fuka + +module m1 + + type :: base + contains + procedure :: fun + end type + + type, extends(base) :: child + end type + +contains + + function fun(o) result(res) + real :: res(3) + class(base) :: o + res = 0 + end function +end module + + +module m2 +contains + + subroutine sub(o) + use m1 + class(child) :: o + real :: res(3) + + res = o%fun() + end subroutine +end module -- 2.30.2