aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/bounds_check_27.f90
blob: 678aef63af6e58f88cb82f4f40dfb2010547f78c (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
40
41
42
43
44
45
! { dg-do run }
! { dg-additional-options "-fcheck=bounds" }
!
! PR fortran/116706 - bogus bounds check for reallocation on assignment
! Contributed by Balint Aradi  <baradi09 at gmail.com>

program testprog
  implicit none

  type :: data_node
     integer, allocatable :: data(:)
  end type data_node

  type :: data_list
     type(data_node), pointer :: nodes(:) => null()
  end type data_list

  type :: upoly_node
     class(*), allocatable :: data(:)
  end type upoly_node

  type :: star_list
     type(upoly_node), pointer :: nodes(:) => null()
  end type star_list

  type(data_list) :: datalist
  type(star_list) :: starlist
  class(star_list), allocatable :: astarlist
  class(star_list), pointer     :: pstarlist

  allocate (datalist%nodes(2))
  datalist%nodes(1)%data = [1, 2, 3]

  allocate (starlist%nodes(2))
  starlist%nodes(1)%data = [1., 2., 3.]

  allocate (astarlist)
  allocate (astarlist%nodes(2))
  astarlist%nodes(1)%data = [1, 2, 3]

  allocate (pstarlist)
  allocate (pstarlist%nodes(2))
  pstarlist%nodes(1)%data = [1., 2., 3.]

end program testprog