Skip to content

Commit 7bb4a01

Browse files
committed
Fix sanitizer failure
I added the insertion point guard "just to be safe" and never removed it. There isn't insertion point guarding on the other route out of this function and we do not preserve the insertion point around getFiniBB either so it is not needed here. The problem flagged by the sanitizers was because the saved insertion point pointed to an instruction which was then removed inside the FiniCB for some clang codegen functions. The instruction was freed when it was removed. Then accessing it to restore the insertion point was a use after free bug.
1 parent 9e92590 commit 7bb4a01

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ Error OpenMPIRBuilder::FinalizationInfo::mergeFiniBB(IRBuilderBase &Builder,
701701
// Simple case: FiniBB does not exist yet: re-use OtherFiniBB.
702702
if (!FiniBB) {
703703
FiniBB = OtherFiniBB;
704-
IRBuilderBase::InsertPointGuard Guard(Builder);
704+
705705
Builder.SetInsertPoint(FiniBB->getFirstNonPHIIt());
706706
if (Error Err = FiniCB(Builder.saveIP()))
707707
return Err;

0 commit comments

Comments
 (0)