|
| 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