llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Aaron Ballman (AaronBallman) <details> <summary>Changes</summary> We were failing to pass a required argument when emitting the diagnostic, so the source range was being used in place of an index. This caused a failed assertion due to the incorrect index. Fixes #<!-- -->139266 --- Full diff: https://github.com/llvm/llvm-project/pull/139277.diff 3 Files Affected: - (modified) clang/docs/ReleaseNotes.rst (+2) - (modified) clang/lib/Sema/SemaOpenMP.cpp (+2-1) - (modified) clang/test/OpenMP/teams_distribute_dist_schedule_messages.cpp (+8) ``````````diff diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 6c32a7e9a5613..f7d56cfd19ce5 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -903,6 +903,8 @@ OpenMP Support - Added support for 'omp stripe' directive. - Fixed a crashing bug with ``omp tile sizes`` if the argument to ``sizes`` was an invalid expression. (#GH139073) +- Fixed a crashing bug with ``omp distribute dist_schedule`` if the argument to + ``dist_schedule`` was not strictly positive. (#GH139266) Improvements ^^^^^^^^^^^^ diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 2534822b72f80..e1c63d582c615 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -22753,7 +22753,8 @@ OMPClause *SemaOpenMP::ActOnOpenMPDistScheduleClause( ValExpr->getIntegerConstantExpr(getASTContext())) { if (Result->isSigned() && !Result->isStrictlyPositive()) { Diag(ChunkSizeLoc, diag::err_omp_negative_expression_in_clause) - << "dist_schedule" << ChunkSize->getSourceRange(); + << "dist_schedule" << /*strictly positive*/ 1 + << ChunkSize->getSourceRange(); return nullptr; } } else if (getOpenMPCaptureRegionForClause( diff --git a/clang/test/OpenMP/teams_distribute_dist_schedule_messages.cpp b/clang/test/OpenMP/teams_distribute_dist_schedule_messages.cpp index 22d2408d3f178..72d8e33173d71 100644 --- a/clang/test/OpenMP/teams_distribute_dist_schedule_messages.cpp +++ b/clang/test/OpenMP/teams_distribute_dist_schedule_messages.cpp @@ -105,3 +105,11 @@ int main(int argc, char **argv) { return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0])); // expected-note {{in instantiation of function template specialization 'tmain<int, 5>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<char, 1>' requested here}} } + +namespace GH139266 { +void f(void) { +#pragma omp distribute dist_schedule(static, 0) // expected-error {[argument to 'dist_schedule' clause must be a strictly positive integer value}} + for (int i = 0; i < 10; i++) + ; +} +} // namespace GH139266 `````````` </details> https://github.com/llvm/llvm-project/pull/139277 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits