diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index bf968d950..631d0881c 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -635,19 +635,18 @@ bool AsmAnalyzer::validateInstructions(evmasm::Instruction _instr, SourceLocatio ); }; - if (( - _instr == evmasm::Instruction::RETURNDATACOPY || - _instr == evmasm::Instruction::RETURNDATASIZE - ) && !m_evmVersion.supportsReturndata()) + if (_instr == evmasm::Instruction::RETURNDATACOPY && !m_evmVersion.supportsReturndata()) errorForVM(7756_error, "only available for Byzantium-compatible"); + else if (_instr == evmasm::Instruction::RETURNDATASIZE && !m_evmVersion.supportsReturndata()) + errorForVM(4778_error, "only available for Byzantium-compatible"); else if (_instr == evmasm::Instruction::STATICCALL && !m_evmVersion.hasStaticCall()) errorForVM(1503_error, "only available for Byzantium-compatible"); - else if (( - _instr == evmasm::Instruction::SHL || - _instr == evmasm::Instruction::SHR || - _instr == evmasm::Instruction::SAR - ) && !m_evmVersion.hasBitwiseShifting()) + else if (_instr == evmasm::Instruction::SHL && !m_evmVersion.hasBitwiseShifting()) errorForVM(6612_error, "only available for Constantinople-compatible"); + else if (_instr == evmasm::Instruction::SHR && !m_evmVersion.hasBitwiseShifting()) + errorForVM(7458_error, "only available for Constantinople-compatible"); + else if (_instr == evmasm::Instruction::SAR && !m_evmVersion.hasBitwiseShifting()) + errorForVM(2054_error, "only available for Constantinople-compatible"); else if (_instr == evmasm::Instruction::CREATE2 && !m_evmVersion.hasCreate2()) errorForVM(6166_error, "only available for Constantinople-compatible"); else if (_instr == evmasm::Instruction::EXTCODEHASH && !m_evmVersion.hasExtCodeHash()) diff --git a/test/libsolidity/syntaxTests/inlineAssembly/evm_byzantium_on_homestead.sol b/test/libsolidity/syntaxTests/inlineAssembly/evm_byzantium_on_homestead.sol index bbb32299f..4c6525116 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/evm_byzantium_on_homestead.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/evm_byzantium_on_homestead.sol @@ -14,7 +14,7 @@ contract C { // ==== // EVMVersion: =homestead // ---- -// TypeError 7756: (86-100): The "returndatasize" instruction is only available for Byzantium-compatible VMs (you are currently compiling for "homestead"). +// TypeError 4778: (86-100): The "returndatasize" instruction is only available for Byzantium-compatible VMs (you are currently compiling for "homestead"). // DeclarationError 3812: (77-102): Variable count mismatch: 1 variables and 0 values. // TypeError 7756: (115-129): The "returndatacopy" instruction is only available for Byzantium-compatible VMs (you are currently compiling for "homestead"). // TypeError 1503: (245-255): The "staticcall" instruction is only available for Byzantium-compatible VMs (you are currently compiling for "homestead"). diff --git a/test/libsolidity/syntaxTests/inlineAssembly/evm_constantinople_on_byzantium.sol b/test/libsolidity/syntaxTests/inlineAssembly/evm_constantinople_on_byzantium.sol index 1e6d85bf1..95f25c384 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/evm_constantinople_on_byzantium.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/evm_constantinople_on_byzantium.sol @@ -17,9 +17,9 @@ contract C { // ---- // TypeError 6612: (103-106): The "shl" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium"). // DeclarationError 8678: (96-116): Variable count does not match number of values (1 vs. 0) -// TypeError 6612: (136-139): The "shr" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium"). +// TypeError 7458: (136-139): The "shr" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium"). // DeclarationError 8678: (129-147): Variable count does not match number of values (1 vs. 0) -// TypeError 6612: (167-170): The "sar" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium"). +// TypeError 2054: (167-170): The "sar" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium"). // DeclarationError 8678: (160-178): Variable count does not match number of values (1 vs. 0) // TypeError 6166: (283-290): The "create2" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium"). // DeclarationError 8678: (276-302): Variable count does not match number of values (1 vs. 0)