summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/nested_allocatables_1.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/nested_allocatables_1.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/nested_allocatables_1.f9028
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/nested_allocatables_1.f90 b/gcc/testsuite/gfortran.dg/nested_allocatables_1.f90
new file mode 100644
index 000000000..607a883b7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/nested_allocatables_1.f90
@@ -0,0 +1,28 @@
+! { dg-do run }
+!
+! PR fortran/40850
+! The code freeing allocatable components used to be put after the code
+! freeing the containing entity.
+!
+! Original test case by Marco Restelli <mrestelli@gmail.com>
+! Reduced by Daniel Franke <franke.daniel@gmail.com>
+! and Janus Weil <janus@gcc.gnu.org>
+
+
+ type t
+ integer, allocatable :: d(:)
+ end type
+ type(t), allocatable :: a(:)
+
+ ! Big enough to make it fail
+ allocate(a(2 * 1024))
+ call sub( (/ a /) )
+
+contains
+
+ subroutine sub(b)
+ type(t) :: b(:)
+ end subroutine
+
+end
+