[OpenMP] Fix crash when diagnosing dist_schedule (#139277)
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
This commit is contained in:
@@ -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
|
||||
^^^^^^^^^^^^
|
||||
|
||||
@@ -22789,7 +22789,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(
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user