aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-06-15 19:14:14 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-02-27 20:42:31 +0800
commit468d0f6199e71f0c7f4b8bd667c8f31feba41a9d (patch)
treeb610955f17d164674effb2e6682162ae8f2e187f /libsolidity
parent9e0446a22c78e8a293a742492f2d2d7cd67af4bd (diff)
downloaddexon-solidity-468d0f6199e71f0c7f4b8bd667c8f31feba41a9d.tar
dexon-solidity-468d0f6199e71f0c7f4b8bd667c8f31feba41a9d.tar.gz
dexon-solidity-468d0f6199e71f0c7f4b8bd667c8f31feba41a9d.tar.bz2
dexon-solidity-468d0f6199e71f0c7f4b8bd667c8f31feba41a9d.tar.lz
dexon-solidity-468d0f6199e71f0c7f4b8bd667c8f31feba41a9d.tar.xz
dexon-solidity-468d0f6199e71f0c7f4b8bd667c8f31feba41a9d.tar.zst
dexon-solidity-468d0f6199e71f0c7f4b8bd667c8f31feba41a9d.zip
Warn on using shift instructions
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/inlineasm/AsmAnalysis.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/libsolidity/inlineasm/AsmAnalysis.cpp b/libsolidity/inlineasm/AsmAnalysis.cpp
index a05ac57d..7653ee51 100644
--- a/libsolidity/inlineasm/AsmAnalysis.cpp
+++ b/libsolidity/inlineasm/AsmAnalysis.cpp
@@ -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,