mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #7386 from ethereum/060-strict-inline-assembly
Defaulting to strict inline assembly (instead of loose)
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly {
|
||||
l:
|
||||
|
||||
l()
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// SyntaxError: (63-64): The use of labels is disallowed. Please use "if", "switch", "for" or function calls instead.
|
||||
// SyntaxError: (63-64): Jump instructions and labels are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch", "if" or "for" statements instead.
|
||||
// TypeError: (73-74): Attempt to call label instead of function.
|
||||
@@ -8,4 +8,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (86-87): Function k used without being called.
|
||||
// ParserError: (92-93): Call or assignment expected.
|
||||
|
||||
+1
-2
@@ -7,5 +7,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// SyntaxError: (75-82): The use of non-functional instructions is disallowed. Please use functional notation instead.
|
||||
// SyntaxError: (95-98): The use of non-functional instructions is disallowed. Please use functional notation instead.
|
||||
// ParserError: (95-98): Expected '(' but got identifier
|
||||
|
||||
@@ -6,4 +6,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// SyntaxError: (75-82): Jump instructions and labels are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch", "if" or "for" statements instead.
|
||||
// DeclarationError: (75-79): Function not found.
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly {
|
||||
jump(xy)
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError: (68-70): Identifier not found.
|
||||
// SyntaxError: (63-71): Jump instructions and labels are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch", "if" or "for" statements instead.
|
||||
@@ -6,5 +6,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// SyntaxError: (75-80): The use of labels is disallowed. Please use "if", "switch", "for" or function calls instead.
|
||||
// SyntaxError: (75-80): Jump instructions and labels are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch", "if" or "for" statements instead.
|
||||
// ParserError: (80-81): Call or assignment expected.
|
||||
|
||||
@@ -6,5 +6,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// SyntaxError: (75-83): Top-level expressions are not supposed to return values (this expression returns 1 value). Use ``pop()`` or assign them.
|
||||
// DeclarationError: (61-93): Unbalanced stack at the end of a block: 1 surplus item(s).
|
||||
// TypeError: (75-83): Top-level expressions are not supposed to return values (this expression returns 1 value). Use ``pop()`` or assign them.
|
||||
|
||||
+1
-2
@@ -6,5 +6,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// SyntaxError: (75-76): Top-level expressions are not supposed to return values (this expression returns 1 value). Use ``pop()`` or assign them.
|
||||
// DeclarationError: (61-86): Unbalanced stack at the end of a block: 1 surplus item(s).
|
||||
// ParserError: (85-86): Call or assignment expected.
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly {
|
||||
return := 1
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError: (70-72): Variable name must precede ":=" in assignment.
|
||||
@@ -1,9 +0,0 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly {
|
||||
return : 1
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError: (70-71): Label name must precede ":".
|
||||
@@ -6,5 +6,4 @@ contract test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// SyntaxError: (73-76): The use of non-functional instructions is disallowed. Please use functional notation instead.
|
||||
// DeclarationError: (59-86): Unbalanced stack at the end of a block: 1 missing item(s).
|
||||
// ParserError: (85-86): Expected '(' but got '}'
|
||||
|
||||
@@ -6,5 +6,4 @@ contract test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// SyntaxError: (73-74): Top-level expressions are not supposed to return values (this expression returns 1 value). Use ``pop()`` or assign them.
|
||||
// DeclarationError: (59-84): Unbalanced stack at the end of a block: 1 surplus item(s).
|
||||
// ParserError: (83-84): Call or assignment expected.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly {
|
||||
_offset
|
||||
let x := _offset
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError: (75-82): In variable names _slot and _offset can only be used as a suffix.
|
||||
// DeclarationError: (84-91): In variable names _slot and _offset can only be used as a suffix.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly {
|
||||
_slot
|
||||
let x := _slot
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError: (75-80): In variable names _slot and _offset can only be used as a suffix.
|
||||
// DeclarationError: (84-89): In variable names _slot and _offset can only be used as a suffix.
|
||||
|
||||
@@ -9,7 +9,7 @@ contract C {
|
||||
assembly { x := 7 }
|
||||
}
|
||||
function g() view public {
|
||||
assembly { for {} 1 { pop(sload(0)) } { } pop(gas) }
|
||||
assembly { for {} 1 { pop(sload(0)) } { } pop(gas()) }
|
||||
}
|
||||
function h() view public {
|
||||
assembly { function g() { pop(blockhash(20)) } }
|
||||
@@ -18,6 +18,6 @@ contract C {
|
||||
assembly { pop(call(0, 1, 2, 3, 4, 5, 6)) }
|
||||
}
|
||||
function k() public {
|
||||
assembly { pop(call(gas, 1, 2, 3, 4, 5, 6)) }
|
||||
assembly { pop(call(gas(), 1, 2, 3, 4, 5, 6)) }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user