]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/80361 ([OOP] bogus recursive call to nonrecursive procedure...
authorJanus Weil <janus@gcc.gnu.org>
Fri, 21 Apr 2017 21:37:16 +0000 (23:37 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Fri, 21 Apr 2017 21:37:16 +0000 (23:37 +0200)
2017-04-21  Janus Weil  <janus@gcc.gnu.org>

Backport from trunk
PR fortran/80361
* class.c (generate_finalization_wrapper): Give the finalization wrapper
the recursive attribute.

2017-04-21  Janus Weil  <janus@gcc.gnu.org>

Backport from trunk
PR fortran/80361
* gfortran.dg/class_62.f90: New test case.

From-SVN: r247071

gcc/fortran/ChangeLog
gcc/fortran/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/class_62.f90 [new file with mode: 0644]

index 30c90d3f60319d6bed7db2c51fe70cae7f40f168..dd51c6b7504882507d55aae9840d31230329cf16 100644 (file)
@@ -1,3 +1,10 @@
+2017-04-21  Janus Weil  <janus@gcc.gnu.org>
+
+       Backport from trunk
+       PR fortran/80361
+       * class.c (generate_finalization_wrapper): Give the finalization wrapper
+       the recursive attribute.
+
 2017-04-14  Dominique d'Humieres  <dominiq@lps.ens.fr>
 
        Backport from trunk
index 4ab96524b24cffae30618a396dcfcc64145903c7..c8f67d5382083ee8ae08bd51d88eb703a1f0052f 100644 (file)
@@ -1599,6 +1599,7 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns,
   final->attr.flavor = FL_PROCEDURE;
   final->attr.function = 1;
   final->attr.pure = 0;
+  final->attr.recursive = 1;
   final->result = final;
   final->ts.type = BT_INTEGER;
   final->ts.kind = 4;
index df0134eb983ebd5ac11931df0a917e10bed653fe..a57d8bdd9a5c1e43f38be667ba9549561d93418c 100644 (file)
@@ -1,3 +1,9 @@
+2017-04-21  Janus Weil  <janus@gcc.gnu.org>
+
+       Backport from trunk
+       PR fortran/80361
+       * gfortran.dg/class_62.f90: New test case.
+
 2017-04-21  Christophe Lyon  <christophe.lyon@linaro.org>
 
        Backport from mainline
diff --git a/gcc/testsuite/gfortran.dg/class_62.f90 b/gcc/testsuite/gfortran.dg/class_62.f90
new file mode 100644 (file)
index 0000000..39ee98d
--- /dev/null
@@ -0,0 +1,29 @@
+! { dg-do run }
+! { dg-options "-fcheck=recursion" }
+!
+! PR 80361: [5/6/7 Regression] bogus recursive call to nonrecursive procedure with -fcheck=recursion
+!
+! Contributed by Jürgen Reuter <juergen.reuter@desy.de>
+
+program main_ut
+
+  implicit none
+
+  type :: prt_spec_expr_t
+  end type
+
+  type :: prt_expr_t
+     class(prt_spec_expr_t), allocatable :: x
+  end type
+
+  type, extends (prt_spec_expr_t) :: prt_spec_list_t
+     type(prt_expr_t) :: e
+  end type
+
+  class(prt_spec_list_t), allocatable :: y
+
+  allocate (y)
+  allocate (prt_spec_list_t :: y%e%x)
+  deallocate(y)
+
+end program