aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/alloc_comp_basics_2.f90
blob: 170a8871f715f68175dbd7da4e1ffb533e0196e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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