Merge pull request #9039 from ethereum/yul-remove-pc-instr

[Yul] remove PC instruction
This commit is contained in:
chriseth 2020-06-03 14:10:35 +02:00 committed by GitHub
commit 1f49edd29d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 10 deletions

View File

@ -8,6 +8,7 @@ Breaking changes:
* Type Checker: Disallow shifts by signed types.
Language Features:
* Yul: Disallow EVM instruction `pc()`.
Compiler Features:

View File

@ -580,16 +580,18 @@ bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation
errorForVM("only available for Constantinople-compatible");
else if (_instr == evmasm::Instruction::CHAINID && !m_evmVersion.hasChainID())
errorForVM("only available for Istanbul-compatible");
else if (_instr == evmasm::Instruction::PC)
m_errorReporter.warning(
2450_error,
_location,
"The \"" +
boost::to_lower_copy(instructionInfo(_instr).name) +
"\" instruction is deprecated and will be removed in the next breaking release."
);
else if (_instr == evmasm::Instruction::SELFBALANCE && !m_evmVersion.hasSelfBalance())
errorForVM("only available for Istanbul-compatible");
else if (_instr == evmasm::Instruction::PC)
{
m_errorReporter.error(
4316_error,
Error::Type::SyntaxError,
_location,
"PC instruction is a low-level EVM feature. "
"Because of that PC is disallowed in strict assembly."
);
}
else if (
_instr == evmasm::Instruction::JUMP ||
_instr == evmasm::Instruction::JUMPI ||

View File

@ -6,4 +6,4 @@ contract C {
}
}
// ----
// Warning: (61-63): The "pc" instruction is deprecated and will be removed in the next breaking release.
// SyntaxError: (61-63): PC instruction is a low-level EVM feature. Because of that PC is disallowed in strict assembly.

View File

@ -4,4 +4,4 @@
// ====
// dialect: evmTyped
// ----
// Warning: (10-12): The "pc" instruction is deprecated and will be removed in the next breaking release.
// SyntaxError: (10-12): PC instruction is a low-level EVM feature. Because of that PC is disallowed in strict assembly.