1! { dg-do run }
2! { dg-options "-fcheck=bounds" }
3! { dg-shouldfail "above upper bound" }
4!
5! PR fortran/29800
6!
7! Contributed by Joost VandeVondele
8!
9
10TYPE data
11  INTEGER :: x(10)
12END TYPE
13TYPE data_areas
14  TYPE(data) :: y(10)
15END TYPE
16
17TYPE(data_areas) :: z(10)
18
19integer, volatile :: i,j,k
20i=1 ; j=1 ; k=11
21
22z(i)%y(j)%x(k)=0
23
24END
25
26! { dg-output "At line 22 of file .*bounds_check_17.f90.*Fortran runtime error: Index '11' of dimension 1 of array 'z%y%x' above upper bound of 10" }
27