Skip to content

[Flang][OpenMP] Allow zero trait score #131473

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

Merged
merged 1 commit into from
Mar 17, 2025
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
2 changes: 1 addition & 1 deletion flang/lib/Semantics/check-omp-structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4942,7 +4942,7 @@ void OmpStructureChecker::CheckTraitSetSelector(
void OmpStructureChecker::CheckTraitScore(const parser::OmpTraitScore &score) {
// [6.0:322:23]
// A score-expression must be a non-negative constant integer expression.
if (auto value{GetIntValue(score)}; !value || value <= 0) {
if (auto value{GetIntValue(score)}; !value || value < 0) {
context_.Say(score.source,
"SCORE expression must be a non-negative constant integer expression"_err_en_US);
}
Expand Down
5 changes: 5 additions & 0 deletions flang/test/Semantics/OpenMP/metadirective-common.f90
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ subroutine f02
!$omp & when(user={condition(score(-2): .true.)}: nothing)
end

subroutine f02_zero_score
!$omp metadirective &
!$omp & when(user={condition(score(0): .true.)}: nothing)
end

subroutine f03(x)
integer :: x
!$omp metadirective &
Expand Down
Loading