summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/spread_init_expr.f03
blob: 05714f623edcb50a745723369484d2dab25c20d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
! { dg-do run }

  INTEGER, PARAMETER :: n = 5
  INTEGER, PARAMETER :: a1(n) = SPREAD(1, 1, n)
  INTEGER, PARAMETER :: a2(n, 3) = SPREAD([1,2,3], DIM=1, NCOPIES=n)
  INTEGER, PARAMETER :: a3(3, n) = SPREAD([1,2,3], DIM=2, NCOPIES=n)

  IF (ANY(a1 /= [ 1, 1, 1, 1, 1 ])) CALL abort()

  IF (ANY(a2(:, 1) /= 1)) CALL abort()
  IF (ANY(a2(:, 2) /= 2)) CALL abort()
  IF (ANY(a2(:, 3) /= 3)) CALL abort()

  IF (ANY(a3(1, :) /= 1)) CALL abort()
  IF (ANY(a3(2, :) /= 2)) CALL abort()
  IF (ANY(a3(3, :) /= 3)) CALL abort()
END