From 2ab320ad365da31f2d02b57d2f03bc291ab64bb9 Mon Sep 17 00:00:00 2001 From: Mikael Morin Date: Mon, 3 Aug 2015 10:03:55 +0000 Subject: [PATCH] Fix random class_allocate_18.f90 failure PR fortran/64921 gcc/fortran/ * class.c (generate_finalization_wrapper): Set finalization procedure symbol's always_explicit attribute. gcc/testsuite/ * gfortran.dg/class_allocate_20.f90: New. From-SVN: r226493 --- gcc/fortran/ChangeLog | 6 ++++ gcc/fortran/class.c | 1 + gcc/testsuite/ChangeLog | 17 ++++++---- .../gfortran.dg/class_allocate_20.f90 | 32 +++++++++++++++++++ 4 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/class_allocate_20.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5bb70f1c68a..03ea33cc996 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2015-08-03 Mikael Morin + + PR fortran/64921 + * class.c (generate_finalization_wrapper): Set finalization + procedure symbol's always_explicit attribute. + 2015-08-01 Paul Thomas PR fortran/67091 diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index 218973dc048..7a9e2755a0f 100644 --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -1599,6 +1599,7 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, final->ts.type = BT_INTEGER; final->ts.kind = 4; final->attr.artificial = 1; + final->attr.always_explicit = 1; final->attr.if_source = expr_null_wrapper ? IFSRC_IFBODY : IFSRC_DECL; if (ns->proc_name->attr.flavor == FL_MODULE) final->module = ns->proc_name->name; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 640289c2c4d..be48d393993 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-08-03 Mikael Morin + + PR fortran/64921 + * gfortran.dg/class_allocate_20.f90: New. + 2015-08-03 Kyrylo Tkachov * gcc.target/aarch64/csel_bfx_1.c: New test. @@ -5,12 +10,12 @@ 2015-08-02 Martin Sebor - * g++.dg/Wframe-address-in-Wall.C: New test. - * g++.dg/Wframe-address.C: New test. - * g++.dg/Wno-frame-address.C: New test. - * gcc.dg/Wframe-address-in-Wall.c: New test. - * gcc.dg/Wframe-address.c: New test. - * gcc.dg/Wno-frame-address.c: New test. + * g++.dg/Wframe-address-in-Wall.C: New test. + * g++.dg/Wframe-address.C: New test. + * g++.dg/Wno-frame-address.C: New test. + * gcc.dg/Wframe-address-in-Wall.c: New test. + * gcc.dg/Wframe-address.c: New test. + * gcc.dg/Wno-frame-address.c: New test. 2015-08-02 Patrick Palka diff --git a/gcc/testsuite/gfortran.dg/class_allocate_20.f90 b/gcc/testsuite/gfortran.dg/class_allocate_20.f90 new file mode 100644 index 00000000000..defe9df9d06 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_allocate_20.f90 @@ -0,0 +1,32 @@ +! { dg-do run } +! +! PR fortran/64921 +! Test that the finalization wrapper procedure get the always_explicit +! attribute so that the array is not passed without descriptor from +! T3's finalization wrapper procedure to T2's one. +! +! Contributed by Mat Cross + +Program test + Implicit None + Type :: t1 + Integer, Allocatable :: i + End Type + Type :: t2 + Integer, Allocatable :: i + End Type + Type, Extends (t1) :: t3 + Type (t2) :: j + End Type + Type, Extends (t3) :: t4 + Integer, Allocatable :: k + End Type + Call s + Print *, 'ok' +Contains + Subroutine s + Class (t1), Allocatable :: x + Allocate (t4 :: x) + End Subroutine +End Program +! { dg-output "ok" } -- 2.30.2