Debian Codegraph @

gcc/testsuite/gfortran.dg/data_array_7.f90

raw
1 ! { dg-do run }
2 !
3 ! Checking for "The new features of Fortran 2008" feature 5.6
4
5 implicit none
6 integer :: a(6)
7 integer :: b(6)
8 integer(kind=4) :: i
9
10 ! Fortran 2008: Subscripts in a data statement can be any constant expression
11 data a(kind("foo")) / 1 /
12 data a(sum([1, 2, 3]) / 3) / 2 /
13 data a(len("foo")) / 3 /
14 data a(kind(i)) / 4 /
15 data a(int(7.0 * atan(1.0)):6) / 5, 6 /
16
17 ! Fortran 2008: nested implied-do limits in a data statement can be any constant expression
18 data (b(i), i = kind("foo"), sum([-1, 1, 2])) / 1, 2 /
19 data (b(i), i = len("foo"), kind(i)) / 3, 4 /
20 data (b(i), i = int(7.0 * atan(1.0)), 6) / 5, 6 /
21
22 ! Check that data was correctly filled
23 if (any(a /= [(i, i = 1, 6)])) stop 1
24 if (any(b /= [(i, i = 1, 6)])) stop 1
25
26 end