mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'origin/develop' into breaking
This commit is contained in:
commit
18de8a56c9
@ -31,6 +31,7 @@ AST Changes:
|
||||
### 0.7.6 (unreleased)
|
||||
|
||||
Language Features:
|
||||
* Code generator: Support copying dynamically encoded structs from calldata to memory.
|
||||
* The fallback function can now also have a single ``calldata`` argument (equaling ``msg.data``) and return ``bytes memory`` (which will not be ABI-encoded but returned as-is).
|
||||
|
||||
Compiler Features:
|
||||
@ -38,6 +39,8 @@ Compiler Features:
|
||||
* SMTChecker: Support named arguments in function calls.
|
||||
* SMTChecker: Support struct constructor.
|
||||
|
||||
Bugfixes:
|
||||
* SMTChecker: Fix internal compiler error when doing bitwise compound assignment with string literals.
|
||||
|
||||
### 0.7.5 (2020-11-18)
|
||||
|
||||
|
@ -1106,11 +1106,22 @@ void CompilerUtils::convertType(
|
||||
}
|
||||
case DataLocation::CallData:
|
||||
{
|
||||
solUnimplementedAssert(!typeOnStack.isDynamicallyEncoded(), "");
|
||||
m_context << Instruction::DUP1;
|
||||
m_context << Instruction::CALLDATASIZE;
|
||||
m_context << Instruction::SUB;
|
||||
abiDecode({&targetType}, false);
|
||||
if (typeOnStack.isDynamicallyEncoded())
|
||||
{
|
||||
solAssert(m_context.useABICoderV2(), "");
|
||||
m_context.callYulFunction(
|
||||
m_context.utilFunctions().conversionFunction(typeOnStack, targetType),
|
||||
1,
|
||||
1
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_context << Instruction::DUP1;
|
||||
m_context << Instruction::CALLDATASIZE;
|
||||
m_context << Instruction::SUB;
|
||||
abiDecode({&targetType}, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DataLocation::Memory:
|
||||
|
@ -433,7 +433,7 @@ bool IRGeneratorForStatements::visit(Assignment const& _assignment)
|
||||
{
|
||||
solAssert(type(_assignment) == leftIntermediate.type(), "");
|
||||
solAssert(type(_assignment) == type(_assignment.leftHandSide()), "");
|
||||
define(_assignment) << shiftOperation(binaryOperator, leftIntermediate, value);
|
||||
define(_assignment) << shiftOperation(binaryOperator, leftIntermediate, value) << "\n";
|
||||
|
||||
writeToLValue(*m_currentLValue, IRVariable(_assignment));
|
||||
m_currentLValue.reset();
|
||||
@ -1010,7 +1010,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
||||
m_utils.packedHashFunction({arg.annotation().type}, {referenceType}) <<
|
||||
"(" <<
|
||||
IRVariable(arg).commaSeparatedList() <<
|
||||
")";
|
||||
")\n";
|
||||
else if (auto functionType = dynamic_cast<FunctionType const*>(paramTypes[i]))
|
||||
{
|
||||
solAssert(
|
||||
@ -1403,6 +1403,8 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
||||
</saltSet>
|
||||
<?isTryCall>
|
||||
let <success> := iszero(iszero(<address>))
|
||||
<!isTryCall>
|
||||
if iszero(<address>) { <forwardingRevert>() }
|
||||
</isTryCall>
|
||||
<releaseTemporaryMemory>()
|
||||
)");
|
||||
@ -1425,6 +1427,8 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
||||
t("isTryCall", _functionCall.annotation().tryCall);
|
||||
if (_functionCall.annotation().tryCall)
|
||||
t("success", IRNames::trySuccessConditionVariable(_functionCall));
|
||||
else
|
||||
t("forwardingRevert", m_utils.forwardingRevertFunction());
|
||||
m_code << t.render();
|
||||
|
||||
break;
|
||||
@ -1581,7 +1585,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess)
|
||||
auto contract = dynamic_cast<ContractDefinition const*>(functionDefinition.scope());
|
||||
solAssert(contract && contract->isLibrary(), "");
|
||||
define(IRVariable(_memberAccess).part("address")) << linkerSymbol(*contract) << "\n";
|
||||
define(IRVariable(_memberAccess).part("functionSelector")) << memberFunctionType->externalIdentifier();
|
||||
define(IRVariable(_memberAccess).part("functionSelector")) << memberFunctionType->externalIdentifier() << "\n";
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1789,15 +1793,13 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess)
|
||||
baseRef <<
|
||||
", " <<
|
||||
offset <<
|
||||
")" <<
|
||||
std::endl;
|
||||
")\n";
|
||||
else
|
||||
define(_memberAccess) <<
|
||||
m_utils.readFromCalldata(*_memberAccess.annotation().type) <<
|
||||
"(" <<
|
||||
offset <<
|
||||
")" <<
|
||||
std::endl;
|
||||
")\n";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -2064,7 +2066,7 @@ void IRGeneratorForStatements::endVisit(IndexAccess const& _indexAccess)
|
||||
IRVariable(_indexAccess.baseExpression()).commaSeparatedList() +
|
||||
", " +
|
||||
expressionAsType(*_indexAccess.indexExpression(), *TypeProvider::uint256()) +
|
||||
")\n";
|
||||
")";
|
||||
if (arrayType.isByteArray())
|
||||
define(_indexAccess) <<
|
||||
m_utils.cleanupFunction(*arrayType.baseType()) <<
|
||||
@ -2078,7 +2080,7 @@ void IRGeneratorForStatements::endVisit(IndexAccess const& _indexAccess)
|
||||
indexAccessFunctionCall <<
|
||||
")\n";
|
||||
else
|
||||
define(_indexAccess) << indexAccessFunctionCall;
|
||||
define(_indexAccess) << indexAccessFunctionCall << "\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1922,18 +1922,24 @@ smtutil::Expression SMTEncoder::compoundAssignment(Assignment const& _assignment
|
||||
|
||||
auto decl = identifierToVariable(_assignment.leftHandSide());
|
||||
|
||||
TypePointer commonType = Type::commonType(
|
||||
_assignment.leftHandSide().annotation().type,
|
||||
_assignment.rightHandSide().annotation().type
|
||||
);
|
||||
solAssert(commonType == _assignment.annotation().type, "");
|
||||
|
||||
if (compoundToBitwise.count(op))
|
||||
return bitwiseOperation(
|
||||
compoundToBitwise.at(op),
|
||||
decl ? currentValue(*decl) : expr(_assignment.leftHandSide()),
|
||||
expr(_assignment.rightHandSide()),
|
||||
decl ? currentValue(*decl) : expr(_assignment.leftHandSide(), _assignment.annotation().type),
|
||||
expr(_assignment.rightHandSide(), _assignment.annotation().type),
|
||||
_assignment.annotation().type
|
||||
);
|
||||
|
||||
auto values = arithmeticOperation(
|
||||
compoundToArithmetic.at(op),
|
||||
decl ? currentValue(*decl) : expr(_assignment.leftHandSide()),
|
||||
expr(_assignment.rightHandSide()),
|
||||
decl ? currentValue(*decl) : expr(_assignment.leftHandSide(), _assignment.annotation().type),
|
||||
expr(_assignment.rightHandSide(), _assignment.annotation().type),
|
||||
_assignment.annotation().type,
|
||||
_assignment
|
||||
);
|
||||
|
@ -59,7 +59,11 @@ object "D_15" {
|
||||
let _3 := add(128, _2)
|
||||
if or(gt(_3, 0xffffffffffffffff), lt(_3, 128)) { panic_error_0x41() }
|
||||
datacopy(128, dataoffset("C_2"), _2)
|
||||
pop(create(_1, 128, _2))
|
||||
if iszero(create(_1, 128, _2))
|
||||
{
|
||||
returndatacopy(_1, _1, returndatasize())
|
||||
revert(_1, returndatasize())
|
||||
}
|
||||
return(allocateMemory(_1), _1)
|
||||
}
|
||||
}
|
||||
|
@ -130,6 +130,8 @@ object \"D_15\" {
|
||||
|
||||
let expr_11_address := create(0, _1, sub(_2, _1))
|
||||
|
||||
if iszero(expr_11_address) { revert_forward_1() }
|
||||
|
||||
releaseTemporaryMemory()
|
||||
let vloc_c_7_address := expr_11_address
|
||||
|
||||
@ -144,6 +146,11 @@ object \"D_15\" {
|
||||
function releaseTemporaryMemory() {
|
||||
}
|
||||
|
||||
function revert_forward_1() {
|
||||
returndatacopy(0, 0, returndatasize())
|
||||
revert(0, returndatasize())
|
||||
}
|
||||
|
||||
function shift_right_224_unsigned(value) -> newValue {
|
||||
newValue :=
|
||||
|
||||
|
@ -35,7 +35,7 @@ object "C_2" {
|
||||
|
||||
======= viair_subobjects/input.sol:D =======
|
||||
Binary:
|
||||
608060405234156100105760006000fd5b60f980610020600039806000f350fe608060405260043610151561007b576000803560e01c6326121ff0141561007957341561002a578081fd5b806003193601121561003a578081fd5b6028806080016080811067ffffffffffffffff8211171561005e5761005d6100b7565b5b50806100d160803980608083f050508061007782610085565bf35b505b60006000fd6100cf565b6000604051905081810181811067ffffffffffffffff821117156100ac576100ab6100b7565b5b80604052505b919050565b634e487b7160e01b600052604160045260246000fd5b565bfe60806040523415600f5760006000fd5b600a80601e600039806000f350fe608060405260006000fd
|
||||
608060405234156100105760006000fd5b61010680610021600039806000f350fe6080604052600436101515610088576000803560e01c6326121ff0141561008657341561002a578081fd5b806003193601121561003a578081fd5b6028806080016080811067ffffffffffffffff8211171561005e5761005d6100c4565b5b50806100de60803980608083f01515610079573d82833e3d82fd5b508061008482610092565bf35b505b60006000fd6100dc565b6000604051905081810181811067ffffffffffffffff821117156100b9576100b86100c4565b5b80604052505b919050565b634e487b7160e01b600052604160045260246000fd5b565bfe60806040523415600f5760006000fd5b600a80601e600039806000f350fe608060405260006000fd
|
||||
Binary of the runtime part:
|
||||
|
||||
Optimized IR:
|
||||
@ -71,7 +71,11 @@ object "D_15" {
|
||||
let _3 := add(128, _2)
|
||||
if or(gt(_3, 0xffffffffffffffff), lt(_3, 128)) { panic_error_0x41() }
|
||||
datacopy(128, dataoffset("C_2"), _2)
|
||||
pop(create(_1, 128, _2))
|
||||
if iszero(create(_1, 128, _2))
|
||||
{
|
||||
returndatacopy(_1, _1, returndatasize())
|
||||
revert(_1, returndatasize())
|
||||
}
|
||||
return(allocateMemory(_1), _1)
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 0
|
||||
// g() -> 0
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
pragma abicoder v2;
|
||||
|
||||
contract c {
|
||||
function test1(uint256[][] calldata c) external returns (uint256, uint256) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
|
@ -16,7 +16,6 @@ contract B {
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// testIt() ->
|
||||
// test() -> 2
|
||||
|
@ -8,7 +8,7 @@ contract B is A {
|
||||
uint public y = f();
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// constructor() ->
|
||||
|
@ -12,6 +12,6 @@ contract D {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> true
|
||||
|
@ -12,6 +12,6 @@ contract D {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 2
|
||||
|
@ -1,20 +0,0 @@
|
||||
contract C {
|
||||
uint8 public a;
|
||||
uint16 public b;
|
||||
uint128 public c;
|
||||
uint public d;
|
||||
constructor() {
|
||||
a = 3;
|
||||
b = 4;
|
||||
c = 5;
|
||||
d = 6;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// a() -> 3
|
||||
// b() -> 4
|
||||
// c() -> 5
|
||||
// d() -> 6
|
14
test/libsolidity/semanticTests/getters/string_and_bytes.sol
Normal file
14
test/libsolidity/semanticTests/getters/string_and_bytes.sol
Normal file
@ -0,0 +1,14 @@
|
||||
contract C {
|
||||
string public a;
|
||||
string public b;
|
||||
bytes public c;
|
||||
constructor() {
|
||||
a = "hello world";
|
||||
b = hex"41424344";
|
||||
c = hex"ff077fff";
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// a() -> 0x20, 11, "hello world"
|
||||
// b() -> 0x20, 4, "ABCD"
|
||||
// c() -> 0x20, 4, -439061522557375173052089223601630338202760422010735733633791622124826263552
|
35
test/libsolidity/semanticTests/getters/value_types.sol
Normal file
35
test/libsolidity/semanticTests/getters/value_types.sol
Normal file
@ -0,0 +1,35 @@
|
||||
contract C {
|
||||
uint8 public a;
|
||||
uint16 public b;
|
||||
uint128 public c;
|
||||
uint public d;
|
||||
bytes1 public e;
|
||||
bytes20 public f;
|
||||
bytes32 public g;
|
||||
bool public h;
|
||||
address public i;
|
||||
constructor() {
|
||||
a = 3;
|
||||
b = 4;
|
||||
c = 5;
|
||||
d = 6;
|
||||
e = bytes1(uint8(0x7f));
|
||||
f = bytes20(uint160(0x64656164626565663135646561640000000000000010));
|
||||
g = bytes32(uint256(0x6465616462656566313564656164000000000000000000000000000000000010));
|
||||
h = true;
|
||||
i = address(type(uint160).max / 3);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// a() -> 3
|
||||
// b() -> 4
|
||||
// c() -> 5
|
||||
// d() -> 6
|
||||
// e() -> 0x7f00000000000000000000000000000000000000000000000000000000000000
|
||||
// f() -> 0x6164626565663135646561640000000000000010000000000000000000000000
|
||||
// g() -> 0x6465616462656566313564656164000000000000000000000000000000000010
|
||||
// h() -> true
|
||||
// i() -> 0x5555555555555555555555555555555555555555
|
@ -0,0 +1,10 @@
|
||||
pragma abicoder v1;
|
||||
contract C {
|
||||
function t(uint) public pure {}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=byzantium
|
||||
// compileViaYul: false
|
||||
// revertStrings: debug
|
||||
// ----
|
||||
// t(uint256) -> FAILURE, hex"08c379a0", 0x20, 0x12, "Calldata too short"
|
@ -0,0 +1,10 @@
|
||||
pragma abicoder v2;
|
||||
contract C {
|
||||
function t(uint) public pure {}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=byzantium
|
||||
// compileViaYul: false
|
||||
// revertStrings: debug
|
||||
// ----
|
||||
// t(uint256) -> FAILURE, hex"08c379a0", 0x20, 34, "ABI decoding: tuple data too sho", "rt"
|
@ -1,4 +1,4 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
@ -42,7 +42,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f((uint128, (uint128, uint256[][2], uint32)), uint32): 0x40, 44, 11, 0x40, 22, 0x60, 33, 0x40, 0x40, 2, 1, 2 -> 44, 22, 1, 2, 33
|
||||
// g(((uint128, uint256[][2], uint32)[2])): 0x20, 0x20, 0x40, 0x40, 22, 0x60, 33, 0x40, 0x40, 2, 1, 2 -> 22, 1, 2, 33
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
pragma abicoder v2;
|
||||
|
||||
struct S {
|
||||
uint128 p1;
|
||||
@ -23,7 +23,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// library: L
|
||||
// f((uint128, (uint128, uint256[][2], uint32)), uint32): 0x40, 44, 11, 0x40, 22, 0x60, 33, 0x40, 0x40, 2, 1, 2 -> 44, 22, 1, 2, 33
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
@ -18,6 +18,6 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint32, (uint128, uint256[][2], uint32)): 55, 0x40, 77, 0x60, 88, 0x40, 0x40, 2, 1, 2 -> 55, 78, 1, 2, 88
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
@ -17,6 +17,6 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint32, (uint128, uint256[][2], uint32)): 55, 0x40, 77, 0x60, 88, 0x40, 0x40, 2, 1, 2 -> 55, 78, 1, 2, 88
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
|
@ -0,0 +1,23 @@
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
uint256 a;
|
||||
bytes b;
|
||||
uint256 c;
|
||||
}
|
||||
|
||||
function f(S calldata c)
|
||||
external
|
||||
pure
|
||||
returns (uint256, byte, byte, uint256)
|
||||
{
|
||||
S memory m = c;
|
||||
return (m.a, m.b[0], m.b[1], m.c);
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f((uint256,bytes,uint256)): 0x20, 42, 0x60, 23, 2, "ab" -> 42, "a", "b", 23
|
@ -1,4 +1,4 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
pragma abicoder v2;
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
@ -18,6 +18,6 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint32, (uint128, uint256[][2], uint32)): 55, 0x40, 77, 0x60, 88, 0x40, 0x40, 2, 1, 2 -> 55, 78, 1, 2, 88
|
||||
|
@ -36,6 +36,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// EVMVersion: >=byzantium
|
||||
// ----
|
||||
// library: L
|
||||
|
@ -19,5 +19,7 @@ contract Test {
|
||||
new C();
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> FAILURE, hex"4e487b71", 0x51
|
||||
|
@ -19,5 +19,7 @@ contract Test {
|
||||
new C();
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> FAILURE, hex"4e487b71", 0x51
|
||||
|
@ -18,7 +18,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test(uint256,uint256): 0, 0 -> FAILURE, hex"4e487b71", 0x32
|
||||
// test(uint256,uint256): 1, 0 -> 1
|
||||
|
@ -6,7 +6,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// create(uint256): 0 -> 0
|
||||
// create(uint256): 7 -> 7
|
||||
|
@ -22,7 +22,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// index(uint256): 0 -> true
|
||||
// index(uint256): 10 -> true
|
||||
|
@ -14,7 +14,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test_indices(uint256): 1 ->
|
||||
// test_indices(uint256): 129 ->
|
||||
|
@ -10,7 +10,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test_boundary_check(uint256,uint256): 10, 11 -> FAILURE, hex"4e487b71", 0x32
|
||||
// test_boundary_check(uint256,uint256): 10, 9 -> 0
|
||||
|
@ -50,7 +50,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test_zeroed_indicies(uint256): 1 ->
|
||||
// test_zeroed_indicies(uint256): 5 ->
|
||||
|
@ -7,7 +7,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// set_get_length(uint256): 0 -> 0
|
||||
// set_get_length(uint256): 1 -> 1
|
||||
|
@ -6,6 +6,6 @@ contract C {
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=petersburg
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// popEmpty() -> FAILURE, hex"4e487b71", 0x31
|
||||
|
@ -9,7 +9,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// EVMVersion: >=petersburg
|
||||
// ----
|
||||
// pushEmpty(uint256): 128
|
||||
|
@ -10,7 +10,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// EVMVersion: >=petersburg
|
||||
// ----
|
||||
// set_get_length(uint256): 0 -> 0
|
||||
|
@ -9,7 +9,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// set_get_length(uint256): 0 -> 0
|
||||
// set_get_length(uint256): 1 -> 0
|
||||
|
@ -14,7 +14,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(bool): true -> true
|
||||
|
@ -11,7 +11,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(bool): true -> true
|
||||
|
@ -37,7 +37,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(address): 0x1234 -> false
|
||||
// f(address): 0x00 -> true
|
||||
|
@ -1,9 +1,11 @@
|
||||
contract C {
|
||||
// If these two functions are identical, the optimiser
|
||||
// on the old codegen path can deduplicate them, and breaking the test.
|
||||
function internal1() internal pure returns (bool) {
|
||||
return true;
|
||||
}
|
||||
function internal2() internal pure returns (bool) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function equal() public pure returns (bool same, bool diff, bool inv) {
|
||||
@ -23,7 +25,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// equal() -> true, false, false
|
||||
|
@ -5,7 +5,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 0x78
|
||||
|
@ -7,7 +7,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// g() -> 0x1234567800000000000000000000000000000000000000000000000000000000
|
||||
|
@ -5,7 +5,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(uint256): 0x12345678 -> 0x78
|
||||
|
@ -9,7 +9,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 0x78
|
||||
|
@ -12,7 +12,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// g() -> 0x78
|
||||
|
@ -8,7 +8,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 0x78
|
||||
|
@ -19,7 +19,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// call_deleted_internal_func() -> FAILURE, hex"4e487b71", 0x51
|
||||
|
@ -17,7 +17,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 0
|
||||
|
@ -60,7 +60,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(bool): 0 -> 23
|
||||
|
@ -8,7 +8,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// keccak1() -> 0x64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107
|
||||
// keccak2() -> 0x64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107
|
||||
|
@ -5,7 +5,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(address): 0x1234 -> 0x1234
|
||||
|
@ -5,7 +5,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(uint256): 6 -> 6
|
||||
|
@ -5,7 +5,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(bool): true -> true
|
||||
|
@ -24,7 +24,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 2
|
||||
|
@ -30,7 +30,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 11
|
||||
|
@ -27,7 +27,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 1
|
||||
|
@ -30,7 +30,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 1024
|
||||
|
@ -5,6 +5,6 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// set(string): 0x20, 32, "01234567890123456789012345678901" ->
|
||||
|
@ -6,7 +6,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// test() -> true
|
||||
|
@ -5,7 +5,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 7
|
||||
|
@ -6,7 +6,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 255
|
||||
|
@ -9,7 +9,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// or(uint256): 0 -> true, 0
|
||||
|
@ -5,7 +5,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(uint256,uint256): 5, 6 -> 5, 6
|
||||
|
@ -12,7 +12,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 6
|
||||
|
@ -1,7 +1,7 @@
|
||||
contract C {
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// allowNonExistingFunctions: true
|
||||
// ----
|
||||
|
@ -29,7 +29,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test_simple(uint256): 0 -> 3, 4, 5
|
||||
// test_simple(uint256): 1 -> 3, 4, 5
|
||||
|
@ -11,7 +11,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f(uint8): 6 -> 9
|
||||
|
@ -11,7 +11,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// setX(uint256): 6 -> 6
|
||||
|
@ -5,7 +5,7 @@ contract C {
|
||||
function h() external pure returns (bytes4) { return 0xcafecafe; }
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f1() -> 0x20, 6, left(0x616263616263)
|
||||
|
@ -19,7 +19,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// short_dyn() -> 0x20, 3, "abc"
|
||||
|
@ -18,7 +18,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 70
|
||||
|
@ -24,7 +24,7 @@ contract C is X {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// compileToEwasm: also
|
||||
// ----
|
||||
// f() -> 3
|
||||
|
@ -0,0 +1,17 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
bytes memory y = "def";
|
||||
y[0] &= "d";
|
||||
assert(y[0] == "d");
|
||||
|
||||
y[0] |= "e";
|
||||
assert(y[0] == "d"); // fails
|
||||
|
||||
y[0] ^= "f";
|
||||
assert(y[0] == (byte("d") | byte("e")) ^ byte("f"));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (189-208): CHC: Assertion violation happens here.
|
@ -0,0 +1,17 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
bytes3 y = "def";
|
||||
y &= "def";
|
||||
assert(y == "def");
|
||||
|
||||
y |= "dee";
|
||||
assert(y == "def"); // fails
|
||||
|
||||
y ^= "fed";
|
||||
assert(y == (bytes3("def") | bytes3("dee")) ^ bytes3("fed"));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (180-198): CHC: Assertion violation happens here.
|
@ -0,0 +1,21 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
bytes32 y = "abcdefghabcdefghabcdefghabcdefgh";
|
||||
bytes32 z = y;
|
||||
y &= "bcdefghabcdefghabcdefghabcdefgha";
|
||||
z &= "bcdefghabcdefghabcdefghabcdefgha";
|
||||
assert(y == "abcdefghabcdefghabcdefghabcdefgh"); // fails
|
||||
|
||||
y |= "cdefghabcdefghabcdefghabcdefghab";
|
||||
z |= "cdefghabcdefghabcdefghabcdefghab";
|
||||
assert(y == "abcdefghabcdefghabcdefghabcd"); // fails
|
||||
|
||||
y ^= "abcdefghabcdefghabcdefghabcdefgh";
|
||||
assert(y == z ^ "abcdefghabcdefghabcdefghabcdefgh");
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (262-309): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (427-470): CHC: Assertion violation happens here.
|
Loading…
Reference in New Issue
Block a user