From c2e88a8a6b03b7cdbeef807b60f030ba10abcfa8 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Mon, 4 Dec 2017 21:30:42 +0000 Subject: [OPENMP] Fix PR35486: crash when collapsing loops with dependent iteration spaces. Though it is incorrect from point of view of OpenMP standard to have dependent iteration space in OpenMP loops, compiler should not crash. Patch fixes this problem. llvm-svn: 319700 --- clang/lib/CodeGen/CGStmtOpenMP.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/CodeGen/CGStmtOpenMP.cpp') diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index 72847fa2827..f96d4f3fd65 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -121,6 +121,9 @@ public: /// of used expression from loop statement. class OMPLoopScope : public CodeGenFunction::RunCleanupsScope { void emitPreInitStmt(CodeGenFunction &CGF, const OMPLoopDirective &S) { + CodeGenFunction::OMPPrivateScope PreCondScope(CGF); + CGF.EmitOMPPrivateLoopCounters(S, PreCondScope); + (void)PreCondScope.Privatize(); if (auto *LD = dyn_cast(&S)) { if (auto *PreInits = cast_or_null(LD->getPreInits())) { for (const auto *I : PreInits->decls()) -- cgit v1.2.3