Files
clang-p2996/flang/test/Semantics/OpenMP/simd-aligned.f90
Raghu Maddhipatla f36a25479b [Flang] [OpenMP] [Semantics] Change SIMD ALIGNED clause support from parsing a std::list<Name> to OmpObjectlist
This is an assisting patch which is implemented to address review comment to switch std::list<Name> to OmpObjectlist from https://reviews.llvm.org/D142722.

Also addressed a semantic check https://github.com/llvm/llvm-project/issues/61161 OpenMP 5.2 standard states that only pointer variables (C_PTR, Cray pointers, POINTER or ALLOCATABLE items) can appear in SIMD aligned clause (section 5.11). And not to allow common block names on an ALIGNED clause.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D152637
2023-06-29 17:24:54 -05:00

69 lines
1.4 KiB
Fortran

! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! OpenMP Version 4.5
! 2.8.1 simd Construct
! Semantic error for correct test case
program omp_simd
integer i, j, k, c, d(100)
integer, allocatable :: a(:), b(:)
common /cmn/ c
allocate(a(10))
allocate(b(10))
!ERROR: List item 'a' present at multiple ALIGNED clauses
!$omp simd aligned(a, a)
do i = 1, 10
a(i) = i
end do
!$omp end simd
!ERROR: List item 'a' present at multiple ALIGNED clauses
!ERROR: List item 'b' present at multiple ALIGNED clauses
!$omp simd aligned(a,a) aligned(b) aligned(b)
do i = 1, 10
a(i) = i
b(i) = i
end do
!$omp end simd
!ERROR: List item 'a' present at multiple ALIGNED clauses
!$omp simd aligned(a) aligned(a)
do i = 1, 10
a(i) = i
end do
!$omp end simd
!$omp simd aligned(a) aligned(b)
do i = 1, 10
a(i) = i
b(i) = i
end do
!$omp end simd
!ERROR: List item 'a' present at multiple ALIGNED clauses
!$omp simd aligned(a) private(a) aligned(a)
do i = 1, 10
a(i) = i
b(i) = i
end do
!$omp end simd
print *, a
!ERROR: 'c' is a common block name and can not appear in an ALIGNED clause
!$omp simd aligned(c)
do i = 1, 10
c = 5
end do
!$omp end simd
!ERROR: 'd' in ALIGNED clause must be of type C_PTR, POINTER or ALLOCATABLE
!$omp simd aligned(d:100)
do i = 1, 100
d(i) = i
end do
end program omp_simd