1! RUN: %S/test_errors.sh %s %t %flang_fc1
2! REQUIRES: shell
3! Test comparisons that use the intrinsic SHAPE() as an operand
4program testShape
5contains
6  subroutine sub1(arrayDummy)
7    integer :: arrayDummy(:)
8    integer, allocatable :: arrayDeferred(:)
9    integer :: arrayLocal(2) = [88, 99]
10    !ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
11    !ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
12    if (all(shape(arrayDummy)==shape(8))) then
13      print *, "hello"
14    end if
15    !ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
16    !ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
17    if (all(shape(27)==shape(arrayDummy))) then
18      print *, "hello"
19    end if
20    if (all(64==shape(arrayDummy))) then
21      print *, "hello"
22    end if
23    !ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
24    !ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
25    if (all(shape(arrayDeferred)==shape(8))) then
26      print *, "hello"
27    end if
28    !ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
29    !ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
30    if (all(shape(27)==shape(arrayDeferred))) then
31      print *, "hello"
32    end if
33    if (all(64==shape(arrayDeferred))) then
34      print *, "hello"
35    end if
36    !ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
37    !ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
38    if (all(shape(arrayLocal)==shape(8))) then
39      print *, "hello"
40    end if
41    !ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
42    !ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
43    if (all(shape(27)==shape(arrayLocal))) then
44      print *, "hello"
45    end if
46    if (all(64==shape(arrayLocal))) then
47      print *, "hello"
48    end if
49  end subroutine sub1
50end program testShape
51