gdb/fortran: array stride support
[binutils-gdb.git] / gdb / testsuite / gdb.fortran / derived-type-striding.f90
1 ! Copyright 2019 Free Software Foundation, Inc.
2 !
3 ! This program is free software; you can redistribute it and/or modify
4 ! it under the terms of the GNU General Public License as published by
5 ! the Free Software Foundation; either version 3 of the License, or
6 ! (at your option) any later version.
7 !
8 ! This program is distributed in the hope that it will be useful,
9 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ! GNU General Public License for more details.
12 !
13 ! You should have received a copy of the GNU General Public License
14 ! along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 program derived_type_member_stride
17 type cartesian
18 integer(kind=8) :: x
19 integer(kind=8) :: y
20 integer(kind=8) :: z
21 end type
22 type mixed_cartesian
23 integer(kind=8) :: x
24 integer(kind=4) :: y
25 integer(kind=8) :: z
26 end type
27 type(cartesian), dimension(10), target :: cloud
28 type(mixed_cartesian), dimension(10), target :: mixed_cloud
29 integer(kind=8), dimension(:), pointer :: point_dimension => null()
30 integer(kind=8), dimension(:), pointer :: point_mixed_dimension => null()
31 cloud(:)%x = 1
32 cloud(:)%y = 2
33 cloud(:)%z = 3
34 point_dimension => cloud(1:9)%y
35 mixed_cloud(:)%x = 1
36 mixed_cloud(:)%y = 2
37 mixed_cloud(:)%z = 3
38 point_mixed_dimension => mixed_cloud(1:4)%z
39 ! Prevent the compiler from optimising the work out.
40 print *, cloud(:)%x ! post_init
41 print *, point_dimension
42 print *, point_mixed_dimension
43 end program