summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/alloc_comp_basics_2.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/alloc_comp_basics_2.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/alloc_comp_basics_2.f9039
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_basics_2.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_basics_2.f90
new file mode 100644
index 00000000000..170a8871f71
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/alloc_comp_basics_2.f90
@@ -0,0 +1,39 @@
+! { dg-do run }
+! Check "double" allocations of allocatable components (PR 20541).
+!
+! Contributed by Erik Edelmann <eedelmann@gcc.gnu.org>
+! and Paul Thomas <pault@gcc.gnu.org>
+!
+program main
+
+ implicit none
+
+ type foo
+ integer, dimension(:), allocatable :: array
+ end type foo
+
+ type(foo),allocatable,dimension(:) :: mol
+ type(foo),pointer,dimension(:) :: molp
+ integer :: i
+
+ allocate (mol(1))
+ allocate (mol(1), stat=i)
+ !print *, i ! /= 0
+ if (i == 0) call abort()
+
+ allocate (mol(1)%array(5))
+ allocate (mol(1)%array(5),stat=i)
+ !print *, i ! /= 0
+ if (i == 0) call abort()
+
+ allocate (molp(1))
+ allocate (molp(1), stat=i)
+ !print *, i ! == 0
+ if (i /= 0) call abort()
+
+ allocate (molp(1)%array(5))
+ allocate (molp(1)%array(5),stat=i)
+ !print *, i ! /= 0
+ if (i == 0) call abort()
+
+end program main