mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
Allways generate stack_get() call to detect stack underflow cases
This commit is contained in:
parent
7906cdd2e8
commit
92f42e98cf
1 changed files with 6 additions and 9 deletions
|
|
@ -168,16 +168,13 @@ void BasicBlock::synchronizeLocalStack(Stack& _evmStack)
|
|||
if (val == nullptr)
|
||||
continue;
|
||||
|
||||
assert(llvm::isa<llvm::PHINode>(val));
|
||||
llvm::PHINode* phi = llvm::cast<llvm::PHINode>(val);
|
||||
if (! phi->use_empty())
|
||||
{
|
||||
// Insert call to get() just before the PHI node and replace
|
||||
// the uses of PHI with the uses of this new instruction.
|
||||
m_builder.SetInsertPoint(phi);
|
||||
auto newVal = _evmStack.get(idx);
|
||||
auto newVal = _evmStack.get(idx); // OPT: Value may be never user but we need to check stack heigth
|
||||
// It is probably a good idea to keep heigth as a local variable accesible by LLVM directly
|
||||
phi->replaceAllUsesWith(newVal);
|
||||
}
|
||||
phi->eraseFromParent();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue