You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Flang][OpenMP] Add some semantic checks for Linear clause (#111354)
This PR adds all the missing semantics for the Linear clause based on
the OpenMP 5.2 restrictions. The restriction details are mentioned
below.
OpenMP 5.2:
5.4.6 linear Clause restrictions
- A linear-modifier may be specified as ref or uval only on a declare
simd directive.
- If linear-modifier is not ref, all list items must be of type integer.
- If linear-modifier is ref or uval, all list items must be dummy
arguments without the VALUE attribute.
- List items must not be Cray pointers or variables that have the
POINTER attribute. Cray pointer support has been deprecated.
- If linear-modifier is ref, list items must be polymorphic variables,
assumed-shape arrays, or variables with the ALLOCATABLE attribute.
- A common block name must not appear in a linear clause.
- The list-item cannot appear more than once
4.4.4 ordered Clause restriction
- If n is explicitly specified, a linear clause must not be specified on
the same directive.
5.11 aligned Clause restriction
- Each list item must have C_PTR or Cray pointer type or have the
POINTER or ALLOCATABLE attribute. Cray pointer support has been
deprecated.
"The list item `%s` specified with the linear-modifier `REF` must be polymorphic variable, assumed-shape array, or a variable with the `ALLOCATABLE` attribute"_err_en_US,
!ERROR: A modifier may not be specified in a LINEAR clause on the DO directive
11
+
!$omp do linear(uval(arg))
12
+
do i =1, 5
13
+
print*, arg(i)
14
+
end do
15
+
endsubroutine linear_clause_01
16
+
17
+
! Case 2
18
+
subroutinelinear_clause_02(arg_01, arg_02)
19
+
!ERROR: The list item `arg_01` specified with other than linear-modifier `REF` must be of type INTEGER
20
+
!$omp declare simd linear(val(arg_01))
21
+
real, intent(in) :: arg_01(:)
22
+
23
+
!ERROR: The list item `arg_02` specified with the linear-modifier `REF` or `UVAL` must be a dummy argument without `VALUE` attribute
24
+
!$omp declare simd linear(uval(arg_02))
25
+
integer, value, intent(in) :: arg_02
26
+
27
+
!ERROR: The list item `var` must be a dummy argument
28
+
!ERROR: The list item `var` in a LINEAR clause must not be Cray Pointer or a variable with POINTER attribute
29
+
!$omp declare simd linear(uval(var))
30
+
integer, pointer:: var
31
+
endsubroutine linear_clause_02
32
+
33
+
! Case 3
34
+
subroutinelinear_clause_03(arg)
35
+
integer, intent(in) :: arg
36
+
!ERROR: The list item `arg` specified with the linear-modifier `REF` must be polymorphic variable, assumed-shape array, or a variable with the `ALLOCATABLE` attribute
37
+
!ERROR: List item 'arg' present at multiple LINEAR clauses
38
+
!$omp declare simd linear(ref(arg)) linear(arg)
39
+
40
+
integer:: i
41
+
common/cc/ i
42
+
!ERROR: The list item `i` must be a dummy argument
43
+
!ERROR: 'i' is a common block name and must not appear in an LINEAR clause
0 commit comments