Skip to content

Commit

Permalink
[sil] Replace a thinko in getNextInstruction().
Browse files Browse the repository at this point in the history
We were using std::next on the pointer, not the iterator meaning we were
accessing bad memory.
  • Loading branch information
gottesmm committed Jan 23, 2021
1 parent f39df1d commit 90b23a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/SIL/IR/SILValue.cpp
Expand Up @@ -83,7 +83,7 @@ SILInstruction *ValueBase::getDefiningInsertionPoint() {

SILInstruction *ValueBase::getNextInstruction() {
if (auto *inst = getDefiningInstruction())
return std::next(inst);
return &*std::next(inst->getIterator());
if (auto *arg = dyn_cast<SILArgument>(this))
return &*arg->getParentBlock()->begin();
return nullptr;
Expand Down

0 comments on commit 90b23a6

Please sign in to comment.