Skip to content

Commit 282a5e6

Browse files
committed
GlobalOpt: fix a use after free
Detected by ASAN. There is no need to remove the copy_address in the loop (which caused an iterator invalidation), because it's deleted with eraseUsesOfInstruction(Call) anyway. rdar://problem/47089910
1 parent 8350d2b commit 282a5e6

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

lib/SILOptimizer/IPO/GlobalOpt.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,6 @@ replaceLoadsByKnownValue(BuiltinInst *CallToOnce, SILFunction *AddrF,
701701
SILBuilder B(CA);
702702
B.createStore(CA->getLoc(), NewAI, CA->getDest(),
703703
StoreOwnershipQualifier::Unqualified);
704-
CA->eraseFromParent();
705704
} else {
706705
// The result of the initializer is used as a value.
707706
replaceLoadSequence(Load, NewAI, B);

0 commit comments

Comments
 (0)