Debian Codegraph @

flang/test/Semantics/OpenMP/omp-atomic-assignment-stmt.f90

raw
1 ! REQUIRES: openmp_runtime
2
3 ! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
4 ! Semantic checks for various assignments related to atomic constructs
5
6 program sample
7 use omp_lib
8 integer :: x, v
9 integer :: y(10)
10 integer, allocatable :: k
11 integer a(10)
12 type sample_type
13 integer :: y
14 integer :: m
15 endtype
16 type(sample_type) :: z
17 !$omp atomic read
18 v = x
19
20 !$omp atomic read
21 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar INTEGER(4) and rank 1 array of INTEGER(4)
22 !ERROR: Expected scalar expression on the RHS of atomic assignment statement
23 v = y(1:3)
24
25 !$omp atomic read
26 !ERROR: Expected scalar variable of intrinsic type on RHS of atomic assignment statement
27 v = x * (10 + x)
28
29 !$omp atomic read
30 !ERROR: Expected scalar variable of intrinsic type on RHS of atomic assignment statement
31 v = 4
32
33 !$omp atomic read
34 !ERROR: k must not have ALLOCATABLE attribute
35 v = k
36
37 !$omp atomic write
38 !ERROR: k must not have ALLOCATABLE attribute
39 k = x
40
41 !$omp atomic update
42 !ERROR: k must not have ALLOCATABLE attribute
43 k = k + x * (v * x)
44
45 !$omp atomic
46 !ERROR: k must not have ALLOCATABLE attribute
47 k = v * k
48
49 !$omp atomic write
50 !ERROR: RHS expression on atomic assignment statement cannot access 'z%y'
51 z%y = x + z%y
52
53 !$omp atomic write
54 !ERROR: RHS expression on atomic assignment statement cannot access 'x'
55 x = x
56
57 !$omp atomic write
58 !ERROR: RHS expression on atomic assignment statement cannot access 'm'
59 m = min(m, x, z%m) + k
60
61 !$omp atomic read
62 !ERROR: RHS expression on atomic assignment statement cannot access 'x'
63 x = x
64
65 !$omp atomic read
66 !ERROR: Expected scalar variable of intrinsic type on RHS of atomic assignment statement
67 !ERROR: RHS expression on atomic assignment statement cannot access 'm'
68 m = min(m, x, z%m) + k
69
70 !$omp atomic read
71 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar INTEGER(4) and rank 1 array of INTEGER(4)
72 !ERROR: Expected scalar expression on the RHS of atomic assignment statement
73 x = a
74
75 !$omp atomic read
76 !ERROR: Expected scalar variable on the LHS of atomic assignment statement
77 a = x
78
79 !$omp atomic write
80 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar INTEGER(4) and rank 1 array of INTEGER(4)
81 !ERROR: Expected scalar expression on the RHS of atomic assignment statement
82 x = a
83
84 !$omp atomic write
85 !ERROR: Expected scalar variable on the LHS of atomic assignment statement
86 a = x
87 end program