Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[OpenMP] Fix crash when diagnosing dist_schedule #139277

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
May 9, 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: 2 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
^^^^^^^^^^^^
Expand Down
3 changes: 2 additions & 1 deletion clang/lib/Sema/SemaOpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 8 additions & 0 deletions clang/test/OpenMP/teams_distribute_dist_schedule_messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Copy link
Contributor

@Fznamznon Fznamznon May 9, 2025

Choose a reason for hiding this comment

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

a { is missing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup, already fixed it. :-)

for (int i = 0; i < 10; i++)
;
}
} // namespace GH139266
Loading