diff --git a/flang/lib/Semantics/check-omp-loop.cpp b/flang/lib/Semantics/check-omp-loop.cpp index 5bbf7bcd627ec..da1aaafbbe080 100644 --- a/flang/lib/Semantics/check-omp-loop.cpp +++ b/flang/lib/Semantics/check-omp-loop.cpp @@ -741,9 +741,9 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Linear &x) { "The list item `%s` in a LINEAR clause must not be Cray Pointer or a variable with POINTER attribute"_err_en_US, symbol->name()); } - if (FindCommonBlockContaining(*symbol)) { + if (symbol->has()) { context_.Say(source, - "'%s' is a common block name and must not appear in an LINEAR clause"_err_en_US, + "'%s' is a common block name and must not appear in a LINEAR clause"_err_en_US, symbol->name()); } } diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp index 9b9da227bdef2..e3caa89fef1d3 100644 --- a/flang/lib/Semantics/check-omp-structure.cpp +++ b/flang/lib/Semantics/check-omp-structure.cpp @@ -586,7 +586,7 @@ void OmpStructureChecker::CheckMultListItems() { for (const auto &ompObject : alignedList.v) { if (const auto *name{parser::Unwrap(ompObject)}) { if (name->symbol) { - if (FindCommonBlockContaining(*(name->symbol))) { + if (name->symbol->has()) { context_.Say(clause->source, "'%s' is a common block name and can not appear in an " "ALIGNED clause"_err_en_US, diff --git a/flang/test/Semantics/OpenMP/linear-clause01.f90 b/flang/test/Semantics/OpenMP/linear-clause01.f90 index 63b09c07875e5..2132ed31a7321 100644 --- a/flang/test/Semantics/OpenMP/linear-clause01.f90 +++ b/flang/test/Semantics/OpenMP/linear-clause01.f90 @@ -44,6 +44,8 @@ subroutine linear_clause_03(arg) integer :: i common /cc/ i !ERROR: The list item `i` must be a dummy argument - !ERROR: 'i' is a common block name and must not appear in an LINEAR clause !$omp declare simd linear(i) + + !ERROR: 'cc' is a common block name and must not appear in a LINEAR clause + !$omp declare simd linear(/cc/) end subroutine linear_clause_03 diff --git a/flang/test/Semantics/OpenMP/simd-aligned.f90 b/flang/test/Semantics/OpenMP/simd-aligned.f90 index 4c410a7c4631b..b72a2c4ff37b8 100644 --- a/flang/test/Semantics/OpenMP/simd-aligned.f90 +++ b/flang/test/Semantics/OpenMP/simd-aligned.f90 @@ -52,13 +52,20 @@ program omp_simd print *, a - !ERROR: 'c' is a common block name and can not appear in an ALIGNED clause + !ERROR: 'c' in ALIGNED clause must be of type C_PTR, POINTER or ALLOCATABLE !$omp simd aligned(c) do i = 1, 10 c = 5 end do !$omp end simd + !ERROR: 'cmn' is a common block name and can not appear in an ALIGNED clause + !$omp simd aligned(/cmn/) + 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 !WARNING: Alignment is not a power of 2, Aligned clause will be ignored [-Wopen-mp-usage] !$omp simd aligned(d:100)