aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8/gcc/testsuite/gfortran.dg/intrinsic_spread_3.f90
blob: 1dd2feb1d2198d17b1cf50c2b9d46911d6e1a2e0 (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
! { dg-do run }
! { dg-require-effective-target fortran_large_int }

program foo
   implicit none
   integer,parameter :: k = selected_int_kind (range (0_8) + 1)

   integer(kind=k), dimension(10) :: i_k
   integer(kind=k), dimension (2, 3) :: a_k
   integer(kind=k), dimension (2, 2, 3) :: b_k
   character (len=200) line1, line2, line3

   a_k = reshape ((/1_k, 2_k, 3_k, 4_k, 5_k, 6_k/), (/2, 3/))
   b_k = spread (a_k, 1, 2)
   if (any (b_k .ne. reshape ((/1_k, 1_k, 2_k, 2_k, 3_k, 3_k, 4_k, 4_k, 5_k, 5_k, 6_k, 6_k/), &
                            (/2, 2, 3/)))) &
      call abort
   line1 = ' '
   write(line1, 9000) b_k
   line2 = ' '
   write(line2, 9000) spread (a_k, 1, 2)
   if (line1 /= line2) call abort
   line3 = ' '
   write(line3, 9000) spread (a_k, 1, 2) + 0_k
   if (line1 /= line3) call abort
   i_k = spread(1_k,1,10)
   if (any(i_k /= 1_k)) call abort

9000 format(12I3)

end program