1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Test comparisons that use the intrinsic SHAPE() as an operand
5 subroutine sub1(arrayDummy
, assumedRank
)
6 integer :: arrayDummy(:), assumedRank(..)
7 integer, allocatable
:: arrayDeferred(:)
8 integer :: arrayLocal(2) = [88, 99]
9 integer, parameter :: aRrs
= rank(shape(assumedRank
))
10 integer(kind
=merge(kind(1),-1,aRrs
== 1)) :: test_aRrs
11 !ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
12 !ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
13 if (all(shape(arrayDummy
)==shape(8))) then
16 !ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
17 !ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
18 if (all(shape(27)==shape(arrayDummy
))) then
21 if (all(64==shape(arrayDummy
))) then
24 !ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
25 !ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
26 if (all(shape(arrayDeferred
)==shape(8))) then
29 !ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
30 !ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
31 if (all(shape(27)==shape(arrayDeferred
))) then
34 if (all(64==shape(arrayDeferred
))) then
37 !ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
38 !ERROR: Dimension 1 of left operand has extent 1, but right operand has extent 0
39 if (all(shape(arrayLocal
)==shape(8))) then
42 !ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
43 !ERROR: Dimension 1 of left operand has extent 0, but right operand has extent 1
44 if (all(shape(27)==shape(arrayLocal
))) then
47 if (all(64==shape(arrayLocal
))) then
50 ! These can't be checked at compilation time
51 if (any(shape(assumedRank
) == [1])) stop
52 if (any(lbound(assumedRank
) == [1,2])) stop
53 if (any(ubound(assumedRank
) == [1,2,3])) stop