Skip to content

Commit

Permalink
Warn on using shift instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Feb 27, 2018
1 parent 9e0446a commit 468d0f6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions libsolidity/inlineasm/AsmAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,22 @@ void AsmAnalyzer::warnOnInstructions(solidity::Instruction _instr, SourceLocatio
"the Metropolis hard fork. Before that it acts as an invalid instruction."
);

static set<solidity::Instruction> experimentalInstructions{
solidity::Instruction::SHL,
solidity::Instruction::SHR,
solidity::Instruction::SAR,
solidity::Instruction::ROL,
solidity::Instruction::ROR
};
if (experimentalInstructions.count(_instr))
m_errorReporter.warning(
_location,
"The \"" +
boost::to_lower_copy(instructionInfo(_instr).name)
+ "\" instruction is only available after " +
"the Constantinople hard fork. Before that it acts as an invalid instruction."
);

if (_instr == solidity::Instruction::JUMP || _instr == solidity::Instruction::JUMPI || _instr == solidity::Instruction::JUMPDEST)
m_errorReporter.warning(
_location,
Expand Down

0 comments on commit 468d0f6

Please sign in to comment.