Skip to content

Commit 5908a32

Browse files
author
git apple-llvm automerger
committed
Merge commit '89577e910eab' from llvm.org/main into next
2 parents a324595 + 89577e9 commit 5908a32

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

flang/lib/Semantics/check-omp-atomic.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,11 @@ void OmpStructureChecker::CheckAtomicVariable(
590590

591591
CheckAtomicType(syms.back(), source, atom.AsFortran(), checkTypeOnPointer);
592592

593-
if (IsAllocatable(syms.back()) && !IsArrayElement(atom)) {
594-
context_.Say(source, "Atomic variable %s cannot be ALLOCATABLE"_err_en_US,
595-
atom.AsFortran());
593+
if (!IsArrayElement(atom) && !ExtractComplexPart(atom)) {
594+
if (IsAllocatable(syms.back())) {
595+
context_.Say(source, "Atomic variable %s cannot be ALLOCATABLE"_err_en_US,
596+
atom.AsFortran());
597+
}
596598
}
597599
}
598600

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
!RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=60 %s -o - | FileCheck %s
2+
3+
! Check that this compiles successfully.
4+
5+
!CHECK: omp.atomic.capture
6+
!CHECK: omp.atomic.read
7+
!CHECK: omp.atomic.update
8+
subroutine f00
9+
implicit none
10+
real :: c
11+
complex, allocatable :: x
12+
!$omp atomic update capture
13+
c = x%re
14+
x%re = x%re + 1.0
15+
!$omp end atomic
16+
end
17+

0 commit comments

Comments
 (0)