aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaOpenMP.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@outlook.com>2023-03-07 08:12:54 -0800
committerAlexey Bataev <a.bataev@outlook.com>2023-03-08 13:06:53 -0800
commit0cfe5ae0b62a54cf76bb2f18eb60acb5e22fcc2d (patch)
tree27ecb5ce8c575aa04341f7be0a9e80955676a972 /clang/lib/Sema/SemaOpenMP.cpp
parent0a4aa8a122aa097499c498b639a75b5e9a73e9f0 (diff)
downloadllvm-0cfe5ae0b62a54cf76bb2f18eb60acb5e22fcc2d.zip
llvm-0cfe5ae0b62a54cf76bb2f18eb60acb5e22fcc2d.tar.gz
llvm-0cfe5ae0b62a54cf76bb2f18eb60acb5e22fcc2d.tar.bz2
[OPENMP]Fix PR59947: "Partially-triangular" loop collapse crashes.
The indeces of the dependent loops are properly ordered, just start from 1, so need just subtract 1 to get correct loop index. Differential Revision: https://reviews.llvm.org/D145514
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r--clang/lib/Sema/SemaOpenMP.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 20e75fb..b87732a 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -10178,10 +10178,8 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr,
Built.DependentInits[Cnt] = nullptr;
Built.FinalsConditions[Cnt] = nullptr;
if (IS.IsNonRectangularLB || IS.IsNonRectangularUB) {
- Built.DependentCounters[Cnt] =
- Built.Counters[NestedLoopCount - 1 - IS.LoopDependentIdx];
- Built.DependentInits[Cnt] =
- Built.Inits[NestedLoopCount - 1 - IS.LoopDependentIdx];
+ Built.DependentCounters[Cnt] = Built.Counters[IS.LoopDependentIdx - 1];
+ Built.DependentInits[Cnt] = Built.Inits[IS.LoopDependentIdx - 1];
Built.FinalsConditions[Cnt] = IS.FinalCondition;
}
}