mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Rename ErrorTag to invalidJumpLabel in inline assembly
This commit is contained in:
parent
702ab4cb4f
commit
ae8403ed08
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Features:
|
Features:
|
||||||
* Do-while loops: support for a C-style do{<block>}while(<expr>); control structure
|
* Do-while loops: support for a C-style do{<block>}while(<expr>); control structure
|
||||||
* Inline assembly: support ``ErrorTag`` as a jump label.
|
* Inline assembly: support ``invalidJumpLabel`` as a jump label.
|
||||||
* Type checker: now more eagerly searches for a common type of an inline array with mixed types
|
* Type checker: now more eagerly searches for a common type of an inline array with mixed types
|
||||||
* Code generator: generates a runtime error when an out-of-range value is converted into an enum type.
|
* Code generator: generates a runtime error when an out-of-range value is converted into an enum type.
|
||||||
|
|
||||||
|
@ -718,7 +718,7 @@ will have a wrong impression about the stack height at label ``two``:
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
``ErrorTag`` is a pre-defined label. Jumping to this location will always
|
``invalidJumpLabel`` is a pre-defined label. Jumping to this location will always
|
||||||
result in an invalid jump, effectively aborting execution of the code.
|
result in an invalid jump, effectively aborting execution of the code.
|
||||||
|
|
||||||
Declaring Assembly-Local Variables
|
Declaring Assembly-Local Variables
|
||||||
|
@ -84,7 +84,7 @@ public:
|
|||||||
LabelOrganizer(GeneratorState& _state): m_state(_state)
|
LabelOrganizer(GeneratorState& _state): m_state(_state)
|
||||||
{
|
{
|
||||||
// Make the Solidity ErrorTag available to inline assembly
|
// Make the Solidity ErrorTag available to inline assembly
|
||||||
m_state.labels.insert(make_pair("ErrorTag", m_state.assembly.errorTag()));
|
m_state.labels.insert(make_pair("invalidJumpLabel", m_state.assembly.errorTag()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE(imbalanced_stack)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(error_tag)
|
BOOST_AUTO_TEST_CASE(error_tag)
|
||||||
{
|
{
|
||||||
BOOST_CHECK(successAssemble("{ ErrorTag }"));
|
BOOST_CHECK(successAssemble("{ invalidJumpLabel }"));
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
@ -7692,13 +7692,13 @@ BOOST_AUTO_TEST_CASE(packed_storage_overflow)
|
|||||||
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(0x1234), u256(0), u256(0), u256(0xfffe)));
|
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(0x1234), u256(0), u256(0), u256(0xfffe)));
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(inline_assembly_errortag)
|
BOOST_AUTO_TEST_CASE(inline_assembly_invalidjumplabel)
|
||||||
{
|
{
|
||||||
char const* sourceCode = R"(
|
char const* sourceCode = R"(
|
||||||
contract C {
|
contract C {
|
||||||
function f() {
|
function f() {
|
||||||
assembly {
|
assembly {
|
||||||
jump(ErrorTag)
|
jump(invalidJumpLabel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user