Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / dosemantics02.f90
blobd6075a8a3f8f8ef79deb6d7e49d67cce5493e3c0
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! C1121 -- any procedure referenced in a concurrent header must be pure
4 ! Also, check that the step expressions are not zero. This is prohibited by
5 ! Section 11.1.7.4.1, paragraph 1.
7 SUBROUTINE do_concurrent_c1121(i,n)
8 IMPLICIT NONE
9 INTEGER :: i, n, flag
10 !ERROR: DO CONCURRENT mask expression may not reference impure procedure 'random'
11 DO CONCURRENT (i = 1:n, random() < 3)
12 flag = 3
13 END DO
15 CONTAINS
16 IMPURE FUNCTION random() RESULT(i)
17 INTEGER :: i
18 i = 35
19 END FUNCTION random
20 END SUBROUTINE do_concurrent_c1121
22 SUBROUTINE s1()
23 INTEGER, PARAMETER :: constInt = 0
25 ! Warn on this one for backwards compatibility
26 !WARNING: DO step expression should not be zero
27 DO 10 I = 1, 10, 0
28 10 CONTINUE
30 ! Warn on this one for backwards compatibility
31 !WARNING: DO step expression should not be zero
32 DO 20 I = 1, 10, 5 - 5
33 20 CONTINUE
35 ! Error, no compatibility requirement for DO CONCURRENT
36 !ERROR: DO CONCURRENT step expression may not be zero
37 DO CONCURRENT (I = 1 : 10 : 0)
38 END DO
40 ! Error, this time with an integer constant
41 !ERROR: DO CONCURRENT step expression may not be zero
42 DO CONCURRENT (I = 1 : 10 : constInt)
43 END DO
44 end subroutine s1