Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions flang/lib/Semantics/check-omp-atomic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,11 @@ void OmpStructureChecker::CheckAtomicVariable(

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

if (IsAllocatable(syms.back()) && !IsArrayElement(atom)) {
context_.Say(source, "Atomic variable %s cannot be ALLOCATABLE"_err_en_US,
atom.AsFortran());
if (!IsArrayElement(atom) && !ExtractComplexPart(atom)) {
if (IsAllocatable(syms.back())) {
context_.Say(source, "Atomic variable %s cannot be ALLOCATABLE"_err_en_US,
atom.AsFortran());
}
}
}

Expand Down
17 changes: 17 additions & 0 deletions flang/test/Lower/OpenMP/atomic-update-capture-complex-part.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
!RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=60 %s -o - | FileCheck %s

! Check that this compiles successfully.

!CHECK: omp.atomic.capture
!CHECK: omp.atomic.read
!CHECK: omp.atomic.update
subroutine f00
implicit none
real :: c
complex, allocatable :: x
!$omp atomic update capture
c = x%re
x%re = x%re + 1.0
!$omp end atomic
end