summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-05 16:15:40 +0000
committermikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-05 16:15:40 +0000
commitfc76ef11eebe645eae0cdca5dc51950abbaedae4 (patch)
tree2f3898b7794118665112e584830b3999713cc87f
parent938e9077a33f8da88bc35de6d931707a594b5e33 (diff)
downloadgcc-fc76ef11eebe645eae0cdca5dc51950abbaedae4.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@226636 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/class.c1
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/class_allocate_20.f9032
4 files changed, 44 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index d76926e9675..cbefb4295d2 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2015-08-05 Mikael Morin <mikael@gcc.gnu.org>
+
+ PR fortran/64921
+ * class.c (generate_finalization_wrapper): Set finalization
+ procedure symbol's always_explicit attribute.
+
2015-08-03 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66942
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 799039999db..fe37d0dbf52 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 c5ac3175189..c6cab70864b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-08-05 Mikael Morin <mikael@gcc.gnu.org>
+
+ PR fortran/64921
+ * gfortran.dg/class_allocate_20.f90: New.
+
2015-08-05 Matthew Wahab <matthew.wahab@arm.com>
Backport from trunk:
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 <mathewc@nag.co.uk>
+
+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" }