1! { dg-do compile }
2! Some CSHIFT, EOSHIFT and UNPACK conformance tests
3!
4program main
5  implicit none
6  real, dimension(1)   :: a1, b1, c1
7  real, dimension(1,1) :: a2, b2, c2
8  real, dimension(1,0) :: a, b, c
9  real :: tempn(1), tempv(5)
10  real,allocatable :: foo(:)
11  allocate(foo(0))
12  tempn = 2.0
13
14  a1 = 0
15  a2 = 0
16  c1 = 0
17  a2 = 0
18
19  b1 = cshift (a1,1)
20  b1 = cshift (a1,(/1/)) ! { dg-error "must be a scalar" }
21  b1 = eoshift (a1,1)
22  b2 = eoshift (a1,c1(1)) ! { dg-error "must be INTEGER" }
23  b1 = eoshift (a1,(/1/)) ! { dg-error "must be a scalar" }
24  b1 = eoshift (a1,1,boundary=c1) ! { dg-error "must be a scalar" }
25  b1 = eoshift (a1,(/1/), boundary=c2) ! { dg-error "must be a scalar" }
26
27  b2 = cshift (a2,1)
28  b2 = cshift (a2,(/1/))
29  b2 = cshift (a2,reshape([1],[1,1])) ! { dg-error "have rank 1 or be a scalar" }
30  b2 = eoshift (a2,1)
31  b2 = eoshift (a2,c1) ! { dg-error "must be INTEGER" }
32  b2 = eoshift (a2,(/1/))
33  b2 = eoshift (a2,reshape([1],[1,1]), boundary=c1) ! { dg-error "have rank 1 or be a scalar" }
34  b2 = eoshift (a2,1,boundary=c2(:,:)) ! { dg-error "have rank 1 or be a scalar" }
35  b2 = eoshift (a2,(/1/), boundary=c2(:,:)) ! { dg-error "have rank 1 or be a scalar" }
36
37  b = eoshift (a,(/1/), boundary=c(1,:)) ! { dg-error "invalid shape in dimension" }
38
39  if (any(eoshift(foo,dim=1,shift=1,boundary=(/42.0,-7.0/))/= 0)) call abort() ! { dg-error "must be a scalar" }
40  if (any(eoshift(tempn(2:1),dim=1,shift=1,boundary=(/42.0,-7.0/))/= 0)) call abort() ! { dg-error "must be a scalar" }
41
42  if (any(unpack(tempv,tempv(1:0)/=0,tempv) /= -47)) call abort() ! { dg-error "must have identical shape" }
43  if (any(unpack(tempv(5:4),tempv(1:0)/=0,tempv) /= -47)) call abort() ! { dg-error "must have identical shape" }
44end program main
45