Skip to content

Commit 7ae981a

Browse files
[Test] Add a test and update a check
1 parent 106d2bf commit 7ae981a

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

flang/test/Semantics/OpenMP/declarative-directive01.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ end subroutine requires_2
2323

2424
subroutine declare_simd_1(a, b)
2525
real(8), intent(inout) :: a, b
26+
!ERROR: 'a' in ALIGNED clause must be of type C_PTR, POINTER or ALLOCATABLE
2627
!$omp declare simd(declare_simd_1) aligned(a)
2728
a = 3.14 + b
2829
end subroutine declare_simd_1
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
! REQUIRES: openmp_runtime
2+
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
3+
! OpenMP Version 5.2
4+
! Various checks for the linear clause
5+
! 5.4.6 `linear` Clause
6+
7+
! Case 1
8+
subroutine linear_clause_01(arg)
9+
integer, intent(in) :: arg(:)
10+
!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+
end subroutine linear_clause_01
16+
17+
! Case 2
18+
subroutine linear_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+
end subroutine linear_clause_02
32+
33+
! Case 3
34+
subroutine linear_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
44+
!$omp declare simd linear(i)
45+
end subroutine linear_clause_03

0 commit comments

Comments
 (0)