Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.fortran / derived-type-striding.f90
CommitLineData
88b9d363 1! Copyright 2019-2022 Free Software Foundation, Inc.
5bbd8269
AB
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
16program 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()
9e80cfa1 31 type(cartesian), dimension(:), pointer :: cloud_slice => null()
5bbd8269
AB
32 cloud(:)%x = 1
33 cloud(:)%y = 2
34 cloud(:)%z = 3
9e80cfa1 35 cloud_slice => cloud(3:2:-2)
5bbd8269
AB
36 point_dimension => cloud(1:9)%y
37 mixed_cloud(:)%x = 1
38 mixed_cloud(:)%y = 2
39 mixed_cloud(:)%z = 3
40 point_mixed_dimension => mixed_cloud(1:4)%z
41 ! Prevent the compiler from optimising the work out.
42 print *, cloud(:)%x ! post_init
43 print *, point_dimension
44 print *, point_mixed_dimension
45end program
This page took 0.297332 seconds and 4 git commands to generate.