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