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

Conversation

kiranchandramohan
Copy link
Contributor

No description provided.

@llvmbot llvmbot added flang Flang issues not falling into any other category flang:openmp flang:semantics labels Mar 15, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 15, 2025

@llvm/pr-subscribers-flang-openmp

@llvm/pr-subscribers-flang-semantics

Author: Kiran Chandramohan (kiranchandramohan)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/131473.diff

2 Files Affected:

  • (modified) flang/lib/Semantics/check-omp-structure.cpp (+1-1)
  • (modified) flang/test/Semantics/OpenMP/metadirective-common.f90 (+5)
diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index 5fcebdca0bc5f..1da47be2fbf18 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -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);
   }
diff --git a/flang/test/Semantics/OpenMP/metadirective-common.f90 b/flang/test/Semantics/OpenMP/metadirective-common.f90
index 4988fae9e8edc..9225048ece3c1 100644
--- a/flang/test/Semantics/OpenMP/metadirective-common.f90
+++ b/flang/test/Semantics/OpenMP/metadirective-common.f90
@@ -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 &

Copy link
Contributor

@kparzysz kparzysz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@kiranchandramohan kiranchandramohan merged commit 93e0df0 into llvm:main Mar 17, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:openmp flang:semantics flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants