Skip to content
Open
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
5 changes: 4 additions & 1 deletion flang/lib/Semantics/resolve-directives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,8 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
Symbol::Flag::OmpIsDevicePtr, Symbol::Flag::OmpHasDeviceAddr};

Symbol::Flags privateDataSharingAttributeFlags{Symbol::Flag::OmpPrivate,
Symbol::Flag::OmpFirstPrivate, Symbol::Flag::OmpLastPrivate};
Symbol::Flag::OmpFirstPrivate, Symbol::Flag::OmpLastPrivate,
Symbol::Flag::OmpLinear};

Symbol::Flags ompFlagsRequireNewSymbol{Symbol::Flag::OmpPrivate,
Symbol::Flag::OmpLinear, Symbol::Flag::OmpFirstPrivate,
Expand Down Expand Up @@ -3263,6 +3264,8 @@ void OmpAttributeVisitor::CheckObjectIsPrivatizable(
clauseName = "FIRSTPRIVATE";
} else if (ompFlag == Symbol::Flag::OmpLastPrivate) {
clauseName = "LASTPRIVATE";
} else if (ompFlag == Symbol::Flag::OmpLinear) {
clauseName = "LINEAR";
}

if (SymbolOrEquivalentIsInNamelist(symbol)) {
Expand Down
10 changes: 9 additions & 1 deletion flang/test/Semantics/OpenMP/private03.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! OpenMP Version 4.5
! Variables that appear in expressions for statement function definitions
! may not appear in private, firstprivate or lastprivate clauses.
! may not appear in private, firstprivate, lastprivate or linear clauses.

subroutine stmt_function(temp)

Expand Down Expand Up @@ -34,6 +34,14 @@ subroutine stmt_function(temp)
end do
!$omp end parallel do

!ERROR: Variable 'p' in statement function expression cannot be in a LINEAR clause
!$omp parallel do simd linear(p)
do i = 1, 10
t(i) = v(temp) + i
p = p + 1
end do
!$omp end parallel do simd

print *, t

end subroutine stmt_function