Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added OpenMP 5.0 specification based semantic checks for CRITICAL con… #1128

Open
wants to merge 2 commits into
base: fir-dev
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion flang/lib/Semantics/resolve-directives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,7 @@ void OmpAttributeVisitor::ResolveOmpName(
} else if (ompFlag == Symbol::Flag::OmpCriticalLock) {
// Create a new symbol.
const auto pair{GetContext().scope.try_emplace(
name.source, Attrs{}, UnknownDetails{})};
name.source, Attrs{}, MiscDetails::Kind::ConstructName)};
NimishMishra marked this conversation as resolved.
Show resolved Hide resolved
CHECK(pair.second);
name.symbol = &pair.first->second.get();
}
Expand Down
18 changes: 18 additions & 0 deletions flang/test/Semantics/critical05.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
! RUN: %python %S/test_symbols.py %s %flang_fc1 -fopenmp
! XFAIL: *
!Checking for name collision of a critical construct with other elements of a program

!DEF: /check_symbols MainProgram
program check_symbols
!DEF: /check_symbols/i ObjectEntity INTEGER(4)
integer i, bar
!REF: /check_symbols/i
foo: do i = 1, 10
end do foo

!$omp critical (foo)
!$omp end critical (foo)

!$omp critical (bar)
!$omp end critical (bar)
end program check_symbols