Skip to content

Commit 93e0df0

Browse files
[Flang][OpenMP] Allow zero trait score (#131473)
1 parent 0878dd1 commit 93e0df0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4969,7 +4969,7 @@ void OmpStructureChecker::CheckTraitSetSelector(
49694969
void OmpStructureChecker::CheckTraitScore(const parser::OmpTraitScore &score) {
49704970
// [6.0:322:23]
49714971
// A score-expression must be a non-negative constant integer expression.
4972-
if (auto value{GetIntValue(score)}; !value || value <= 0) {
4972+
if (auto value{GetIntValue(score)}; !value || value < 0) {
49734973
context_.Say(score.source,
49744974
"SCORE expression must be a non-negative constant integer expression"_err_en_US);
49754975
}

flang/test/Semantics/OpenMP/metadirective-common.f90

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ subroutine f02
2121
!$omp & when(user={condition(score(-2): .true.)}: nothing)
2222
end
2323

24+
subroutine f02_zero_score
25+
!$omp metadirective &
26+
!$omp & when(user={condition(score(0): .true.)}: nothing)
27+
end
28+
2429
subroutine f03(x)
2530
integer :: x
2631
!$omp metadirective &

0 commit comments

Comments
 (0)