mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8323 from ethereum/smt_split_3
[SMTChecker] CHC support to internal function calls
This commit is contained in:
commit
07ab4c80c4
@ -43,6 +43,7 @@ Compiler Features:
|
||||
* Code Generator: Use ``calldatacopy`` instead of ``codecopy`` to zero out memory past input.
|
||||
* Debug: Provide reason strings for compiler-generated internal reverts when using the ``--revert-strings`` option or the ``settings.debug.revertStrings`` setting on ``debug`` mode.
|
||||
* Yul Optimizer: Prune functions that call each other but are otherwise unreferenced.
|
||||
* SMTChecker: CHC support to internal function calls.
|
||||
|
||||
|
||||
Bugfixes:
|
||||
|
@ -432,12 +432,6 @@ void BMC::inlineFunctionCall(FunctionCall const& _funCall)
|
||||
m_context.newValue(*param);
|
||||
m_context.setUnknownValue(*param);
|
||||
}
|
||||
|
||||
m_errorReporter.warning(
|
||||
_funCall.location(),
|
||||
"Assertion checker does not support recursive function calls.",
|
||||
SecondarySourceLocation().append("Starting from function:", funDef->location())
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -459,6 +459,8 @@ void CHC::endVisit(FunctionCall const& _funCall)
|
||||
SMTEncoder::endVisit(_funCall);
|
||||
break;
|
||||
case FunctionType::Kind::Internal:
|
||||
internalFunctionCall(_funCall);
|
||||
break;
|
||||
case FunctionType::Kind::External:
|
||||
case FunctionType::Kind::DelegateCall:
|
||||
case FunctionType::Kind::BareCall:
|
||||
@ -525,6 +527,39 @@ void CHC::visitAssert(FunctionCall const& _funCall)
|
||||
m_context.addAssertion(m_error.currentValue() == previousError);
|
||||
}
|
||||
|
||||
void CHC::internalFunctionCall(FunctionCall const& _funCall)
|
||||
{
|
||||
solAssert(m_currentContract, "");
|
||||
|
||||
auto const* function = functionCallToDefinition(_funCall);
|
||||
if (function)
|
||||
{
|
||||
if (m_currentFunction && !m_currentFunction->isConstructor())
|
||||
m_callGraph[m_currentFunction].insert(function);
|
||||
else
|
||||
m_callGraph[m_currentContract].insert(function);
|
||||
auto const* contract = function->annotation().contract;
|
||||
|
||||
// Libraries can have constants as their "state" variables,
|
||||
// so we need to ensure they were constructed correctly.
|
||||
if (contract->isLibrary())
|
||||
m_context.addAssertion(interface(*contract));
|
||||
}
|
||||
|
||||
auto previousError = m_error.currentValue();
|
||||
|
||||
m_context.addAssertion(predicate(_funCall));
|
||||
|
||||
connectBlocks(
|
||||
m_currentBlock,
|
||||
(m_currentFunction && !m_currentFunction->isConstructor()) ? summary(*m_currentFunction) : summary(*m_currentContract),
|
||||
(m_error.currentValue() > 0)
|
||||
);
|
||||
m_context.addAssertion(m_error.currentValue() == 0);
|
||||
m_error.increaseIndex();
|
||||
m_context.addAssertion(m_error.currentValue() == previousError);
|
||||
}
|
||||
|
||||
void CHC::unknownFunctionCall(FunctionCall const&)
|
||||
{
|
||||
/// Function calls are not handled at the moment,
|
||||
@ -580,12 +615,7 @@ void CHC::clearIndices(ContractDefinition const* _contract, FunctionDefinition c
|
||||
|
||||
bool CHC::shouldVisit(FunctionDefinition const& _function) const
|
||||
{
|
||||
if (
|
||||
_function.isPublic() &&
|
||||
_function.isImplemented()
|
||||
)
|
||||
return true;
|
||||
return false;
|
||||
return _function.isImplemented();
|
||||
}
|
||||
|
||||
void CHC::setCurrentBlock(
|
||||
@ -919,6 +949,34 @@ smt::Expression CHC::predicate(
|
||||
return _block(_arguments);
|
||||
}
|
||||
|
||||
smt::Expression CHC::predicate(FunctionCall const& _funCall)
|
||||
{
|
||||
auto const* function = functionCallToDefinition(_funCall);
|
||||
if (!function)
|
||||
return smt::Expression(true);
|
||||
|
||||
m_error.increaseIndex();
|
||||
vector<smt::Expression> args{m_error.currentValue()};
|
||||
auto const* contract = function->annotation().contract;
|
||||
|
||||
args += contract->isLibrary() ? stateVariablesAtIndex(0, *contract) : currentStateVariables();
|
||||
args += symbolicArguments(_funCall);
|
||||
for (auto const& var: m_stateVariables)
|
||||
m_context.variable(*var)->increaseIndex();
|
||||
args += contract->isLibrary() ? stateVariablesAtIndex(1, *contract) : currentStateVariables();
|
||||
|
||||
auto const& returnParams = function->returnParameters();
|
||||
for (auto param: returnParams)
|
||||
if (m_context.knownVariable(*param))
|
||||
m_context.variable(*param)->increaseIndex();
|
||||
else
|
||||
createVariable(*param);
|
||||
for (auto const& var: function->returnParameters())
|
||||
args.push_back(m_context.variable(*var)->currentValue());
|
||||
|
||||
return (*m_summaries.at(contract).at(function))(args);
|
||||
}
|
||||
|
||||
void CHC::addRule(smt::Expression const& _rule, string const& _ruleName)
|
||||
{
|
||||
m_interface->addRule(_rule, _ruleName);
|
||||
|
@ -76,6 +76,7 @@ private:
|
||||
void endVisit(Continue const& _node) override;
|
||||
|
||||
void visitAssert(FunctionCall const& _funCall);
|
||||
void internalFunctionCall(FunctionCall const& _funCall);
|
||||
void unknownFunctionCall(FunctionCall const& _funCall);
|
||||
//@}
|
||||
|
||||
@ -164,6 +165,8 @@ private:
|
||||
smt::Expression predicate(smt::SymbolicFunctionVariable const& _block);
|
||||
/// @returns a predicate application over @param _arguments.
|
||||
smt::Expression predicate(smt::SymbolicFunctionVariable const& _block, std::vector<smt::Expression> const& _arguments);
|
||||
/// @returns the summary predicate for the called function.
|
||||
smt::Expression predicate(FunctionCall const& _funCall);
|
||||
/// @returns a predicate that defines a constructor summary.
|
||||
smt::Expression summary(ContractDefinition const& _contract);
|
||||
/// @returns a predicate that defines a function summary.
|
||||
|
@ -673,7 +673,6 @@ void SMTEncoder::visitAssert(FunctionCall const& _funCall)
|
||||
auto const& args = _funCall.arguments();
|
||||
solAssert(args.size() == 1, "");
|
||||
solAssert(args.front()->annotation().type->category() == Type::Category::Bool, "");
|
||||
addPathImpliedExpression(expr(*args.front()));
|
||||
}
|
||||
|
||||
void SMTEncoder::visitRequire(FunctionCall const& _funCall)
|
||||
|
@ -6,23 +6,17 @@ contract c {
|
||||
x = x + 1;
|
||||
return x;
|
||||
}
|
||||
function g(bool a) public returns (bool) {
|
||||
function g() public returns (bool) {
|
||||
bool b;
|
||||
if (a) {
|
||||
x = 0;
|
||||
b = (f() == 0) && (f() == 0);
|
||||
assert(x == 1);
|
||||
assert(!b);
|
||||
} else {
|
||||
x = 100;
|
||||
b = (f() > 0) && (f() > 0);
|
||||
b = f() > 0;
|
||||
assert(x == 102);
|
||||
// Should fail.
|
||||
assert(!b);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (101-106): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (362-372): Assertion violation happens here
|
||||
// Warning: (202-218): Assertion violation happens here
|
||||
// Warning: (242-252): Assertion violation happens here
|
||||
|
@ -19,4 +19,6 @@ contract A is B {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (217-222): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (265-270): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (253-271): Assertion violation happens here
|
||||
|
@ -26,4 +26,6 @@ contract A is B2, B1 {
|
||||
}
|
||||
// ----
|
||||
// Warning: (214-219): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (214-219): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (342-347): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (330-348): Assertion violation happens here
|
||||
|
@ -26,4 +26,6 @@ contract A is B2, B1 {
|
||||
}
|
||||
// ----
|
||||
// Warning: (214-219): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (214-219): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (342-347): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (330-348): Assertion violation happens here
|
||||
|
@ -31,4 +31,7 @@ contract A is B2, B1 {
|
||||
// Warning: (174-179): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (239-244): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (262-267): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (239-244): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (262-267): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (174-179): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (362-378): Assertion violation happens here
|
||||
|
@ -26,4 +26,5 @@ contract A is B {
|
||||
}
|
||||
// ----
|
||||
// Warning: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (356-370): Assertion violation happens here
|
||||
|
@ -14,3 +14,4 @@ contract A is C {
|
||||
}
|
||||
// ----
|
||||
// Warning: (148-162): Assertion violation happens here
|
||||
// Warning: (166-182): Assertion violation happens here
|
||||
|
@ -9,5 +9,3 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (99-107): Assertion checker does not support recursive function calls.
|
||||
// Warning: (141-144): Assertion checker does not support recursive function calls.
|
||||
|
@ -2,40 +2,22 @@ pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
uint x;
|
||||
uint y;
|
||||
uint z;
|
||||
|
||||
function f() public {
|
||||
if (x == 1)
|
||||
x = 2;
|
||||
else
|
||||
x = 1;
|
||||
g();
|
||||
if (y != 1)
|
||||
g();
|
||||
assert(y == 1);
|
||||
}
|
||||
|
||||
function g() public {
|
||||
function g() internal {
|
||||
y = 1;
|
||||
h();
|
||||
assert(z == 1);
|
||||
}
|
||||
|
||||
function h() public {
|
||||
z = 1;
|
||||
x = 1;
|
||||
function h() internal {
|
||||
f();
|
||||
// This fails for the following calls to the contract:
|
||||
// h()
|
||||
// g() h()
|
||||
// It does not fail for f() g() h() because in that case
|
||||
// h() will not inline f() since it already is in the callstack.
|
||||
assert(x == 1);
|
||||
assert(y == 1);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (271-274): Assertion checker does not support recursive function calls.
|
||||
// Warning: (140-143): Assertion checker does not support recursive function calls.
|
||||
// Warning: (483-497): Assertion violation happens here
|
||||
// Warning: (201-204): Assertion checker does not support recursive function calls.
|
||||
// Warning: (483-497): Assertion violation happens here
|
||||
|
@ -14,4 +14,3 @@ contract C
|
||||
}
|
||||
|
||||
// ----
|
||||
// Warning: (111-114): Assertion checker does not support recursive function calls.
|
||||
|
@ -22,5 +22,4 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (206-209): Assertion checker does not support recursive function calls.
|
||||
// Warning: (111-114): Assertion checker does not support recursive function calls.
|
||||
// Warning: (130-144): Error trying to invoke SMT solver.
|
||||
|
@ -0,0 +1,25 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C{
|
||||
uint x;
|
||||
constructor(uint y) public {
|
||||
assert(x == 0);
|
||||
x = 1;
|
||||
}
|
||||
function f() public {
|
||||
assert(x == 1);
|
||||
++x;
|
||||
g();
|
||||
assert(x == 1);
|
||||
}
|
||||
|
||||
function g() internal {
|
||||
assert(x == 2);
|
||||
--x;
|
||||
assert(x == 1);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning.
|
||||
// Warning: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (245-248): Underflow (resulting value less than 0) happens here
|
@ -0,0 +1,32 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C{
|
||||
uint x;
|
||||
constructor(uint y) public {
|
||||
assert(x == 1);
|
||||
x = 1;
|
||||
}
|
||||
function f() public {
|
||||
assert(x == 2);
|
||||
++x;
|
||||
g();
|
||||
assert(x == 2);
|
||||
}
|
||||
|
||||
function g() internal {
|
||||
assert(x == 3);
|
||||
--x;
|
||||
assert(x == 2);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning.
|
||||
// Warning: (145-159): Assertion violation happens here
|
||||
// Warning: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (227-241): Assertion violation happens here
|
||||
// Warning: (252-266): Assertion violation happens here
|
||||
// Warning: (177-191): Assertion violation happens here
|
||||
// Warning: (227-241): Assertion violation happens here
|
||||
// Warning: (245-248): Underflow (resulting value less than 0) happens here
|
||||
// Warning: (252-266): Assertion violation happens here
|
||||
// Warning: (89-103): Assertion violation happens here
|
@ -0,0 +1,21 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract A {
|
||||
uint x;
|
||||
function f() internal {
|
||||
assert(x == 1);
|
||||
--x;
|
||||
}
|
||||
}
|
||||
|
||||
contract C is A {
|
||||
constructor() public {
|
||||
assert(x == 0);
|
||||
++x;
|
||||
f();
|
||||
assert(x == 0);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (100-103): Underflow (resulting value less than 0) happens here
|
||||
// Warning: (100-103): Underflow (resulting value less than 0) happens here
|
@ -0,0 +1,26 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract A {
|
||||
uint x;
|
||||
function f() internal {
|
||||
assert(x == 2);
|
||||
--x;
|
||||
}
|
||||
}
|
||||
|
||||
contract C is A {
|
||||
constructor() public {
|
||||
assert(x == 1);
|
||||
++x;
|
||||
f();
|
||||
assert(x == 1);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (82-96): Assertion violation happens here
|
||||
// Warning: (100-103): Underflow (resulting value less than 0) happens here
|
||||
// Warning: (82-96): Assertion violation happens here
|
||||
// Warning: (100-103): Underflow (resulting value less than 0) happens here
|
||||
// Warning: (155-169): Assertion violation happens here
|
||||
// Warning: (82-96): Assertion violation happens here
|
||||
// Warning: (187-201): Assertion violation happens here
|
@ -0,0 +1,27 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C{
|
||||
uint x;
|
||||
constructor(uint y) public {
|
||||
assert(x == 0);
|
||||
x = 1;
|
||||
}
|
||||
function f() public {
|
||||
assert(x == 1);
|
||||
++x;
|
||||
++x;
|
||||
g();
|
||||
g();
|
||||
assert(x == 1);
|
||||
}
|
||||
|
||||
function g() internal {
|
||||
--x;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning.
|
||||
// Warning: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (170-173): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (241-244): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (241-244): Underflow (resulting value less than 0) happens here
|
@ -0,0 +1,30 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C{
|
||||
uint x;
|
||||
constructor(uint y) public {
|
||||
assert(x == 1);
|
||||
x = 1;
|
||||
}
|
||||
function f() public {
|
||||
assert(x == 2);
|
||||
++x;
|
||||
++x;
|
||||
g();
|
||||
g();
|
||||
assert(x == 3);
|
||||
}
|
||||
|
||||
function g() internal {
|
||||
--x;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (70-76): Unused function parameter. Remove or comment out the variable name to silence this warning.
|
||||
// Warning: (145-159): Assertion violation happens here
|
||||
// Warning: (163-166): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (170-173): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (241-244): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (191-205): Assertion violation happens here
|
||||
// Warning: (241-244): Underflow (resulting value less than 0) happens here
|
||||
// Warning: (89-103): Assertion violation happens here
|
@ -0,0 +1,18 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C {
|
||||
function g(uint y) public {
|
||||
uint z = L.f(y);
|
||||
assert(z == y);
|
||||
}
|
||||
}
|
||||
|
||||
library L {
|
||||
function f(uint x) internal returns (uint) {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// Warning: (131-190): Function state mutability can be restricted to pure
|
||||
// Warning: (86-87): Assertion checker does not yet implement type type(library L)
|
@ -9,4 +9,3 @@ contract C {
|
||||
}
|
||||
//
|
||||
// ----
|
||||
// Warning: (126-129): Assertion checker does not support recursive function calls.
|
||||
|
@ -25,4 +25,3 @@ a;
|
||||
// ----
|
||||
// Warning: (72-90): Statement has no effect.
|
||||
// Warning: (96-107): Statement has no effect.
|
||||
// Warning: (304-307): Assertion checker does not support recursive function calls.
|
||||
|
@ -26,4 +26,5 @@ contract A is B {
|
||||
}
|
||||
// ----
|
||||
// Warning: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (356-370): Assertion violation happens here
|
||||
|
@ -24,4 +24,10 @@ contract A is B {
|
||||
// ----
|
||||
// Warning: (171-176): Underflow (resulting value less than 0) happens here
|
||||
// Warning: (171-176): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (230-235): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (171-176): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (260-265): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (282-287): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (282-291): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (308-313): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (296-314): Assertion violation happens here
|
||||
|
@ -23,4 +23,9 @@ contract A is B {
|
||||
|
||||
// ----
|
||||
// Warning: (171-177): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (231-236): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (171-177): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (261-266): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (283-289): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (306-311): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (294-312): Assertion violation happens here
|
||||
|
@ -13,5 +13,3 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (162-175): Assertion violation happens here
|
||||
// Warning: (179-193): Assertion violation happens here
|
||||
|
@ -1,5 +1,8 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
// This test gets different results on Linux and OSX.
|
||||
// Re-enable when fixed (SMTSolvers: z3)
|
||||
|
||||
contract Simple {
|
||||
function f() public pure {
|
||||
uint x = 10;
|
||||
@ -16,9 +19,7 @@ contract Simple {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTSolvers: z3
|
||||
// SMTSolvers: none
|
||||
// ----
|
||||
// Warning: (172-187): Error trying to invoke SMT solver.
|
||||
// Warning: (195-209): Error trying to invoke SMT solver.
|
||||
// Warning: (172-187): Assertion violation happens here
|
||||
// Warning: (195-209): Assertion violation happens here
|
||||
|
@ -12,10 +12,4 @@ contract Simple {
|
||||
assert(y == x);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTSolvers: z3
|
||||
// ----
|
||||
// Warning: (164-179): Error trying to invoke SMT solver.
|
||||
// Warning: (187-201): Error trying to invoke SMT solver.
|
||||
// Warning: (164-179): Assertion violation happens here
|
||||
// Warning: (187-201): Assertion violation happens here
|
||||
|
@ -5,10 +5,6 @@ contract C
|
||||
function f(uint x, bool b) public pure {
|
||||
require(x < 10);
|
||||
for (; x < 10; ) {
|
||||
if (b) {
|
||||
x = 20;
|
||||
continue;
|
||||
}
|
||||
++x;
|
||||
}
|
||||
assert(x > 15);
|
||||
@ -17,4 +13,5 @@ contract C
|
||||
// ====
|
||||
// SMTSolvers: z3
|
||||
// ----
|
||||
// Warning: (185-199): Assertion violation happens here
|
||||
// Warning: (66-72): Unused function parameter. Remove or comment out the variable name to silence this warning.
|
||||
// Warning: (142-156): Assertion violation happens here
|
||||
|
@ -13,8 +13,6 @@ contract C
|
||||
assert(x > 0);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTSolvers: z3
|
||||
// ----
|
||||
// Warning: (296-309): Error trying to invoke SMT solver.
|
||||
// Warning: (176-181): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
|
@ -14,8 +14,6 @@ contract LoopFor2 {
|
||||
assert(b[0] == 900);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTSolvers: z3
|
||||
// ----
|
||||
// Warning: (281-301): Assertion violation happens here
|
||||
// Warning: (305-324): Assertion violation happens here
|
||||
|
@ -4,6 +4,7 @@ contract C {
|
||||
function f(uint x, uint y) public pure {
|
||||
x = 7;
|
||||
while ((x = y) > 0) {
|
||||
--y;
|
||||
}
|
||||
assert(x == 7);
|
||||
}
|
||||
@ -11,4 +12,4 @@ contract C {
|
||||
// ====
|
||||
// SMTSolvers: z3
|
||||
// ----
|
||||
// Warning: (216-230): Assertion violation happens here
|
||||
// Warning: (224-238): Assertion violation happens here
|
||||
|
@ -28,8 +28,6 @@ contract C
|
||||
assert(x >= 20);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTSolvers: z3
|
||||
// ----
|
||||
// Warning: (329-344): Assertion violation happens here
|
||||
// Warning: (380-395): Assertion violation happens here
|
||||
|
@ -26,8 +26,6 @@ contract C
|
||||
assert(x >= 20);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTSolvers: z3
|
||||
// ----
|
||||
// Warning: (323-338): Assertion violation happens here
|
||||
// Warning: (362-377): Assertion violation happens here
|
||||
|
@ -21,4 +21,5 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (203-208): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (136-149): Assertion violation happens here
|
||||
|
@ -17,6 +17,3 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (86-93): Assertion checker does not support recursive function calls.
|
||||
// Warning: (86-93): Assertion checker does not support recursive function calls.
|
||||
// Warning: (253-266): Assertion violation happens here
|
||||
|
@ -4,7 +4,7 @@ contract C
|
||||
{
|
||||
uint[][] a;
|
||||
function f(bool b) public {
|
||||
require(a[2][3] == 4);
|
||||
a[2][3] = 4;
|
||||
if (b)
|
||||
delete a;
|
||||
else
|
||||
@ -13,5 +13,7 @@ contract C
|
||||
assert(a[1][1] == 0);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTSolvers: z3
|
||||
// ----
|
||||
// Warning: (184-204): Assertion violation happens here
|
||||
// Warning: (174-194): Assertion violation happens here
|
||||
|
@ -20,6 +20,7 @@ contract C
|
||||
// Warning: (165-204): Assertion violation happens here
|
||||
// Warning: (208-240): Assertion violation happens here
|
||||
// Warning: (244-275): Assertion violation happens here
|
||||
// Warning: (311-316): Overflow (resulting value larger than 2**256 - 1) happens here
|
||||
// Warning: (304-332): Assertion violation happens here
|
||||
// Warning: (336-352): Assertion violation happens here
|
||||
// Warning: (356-379): Assertion violation happens here
|
||||
|
@ -1,13 +1,23 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
function(uint) returns (uint) a;
|
||||
function(uint) returns (uint) b;
|
||||
function f(function(uint) returns (uint) g, function(uint) returns (uint) h) internal {
|
||||
assert(g(2) == h(2));
|
||||
assert(g == h);
|
||||
}
|
||||
function g() public {
|
||||
f(a, b);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (146-150): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (154-158): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (170-176): Assertion checker does not yet implement the type function (uint256) returns (uint256) for comparisons
|
||||
// Warning: (139-159): Assertion violation happens here
|
||||
// Warning: (163-177): Assertion violation happens here
|
||||
// Warning: (214-218): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (222-226): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (238-244): Assertion checker does not yet implement the type function (uint256) returns (uint256) for comparisons
|
||||
// Warning: (207-227): Assertion violation happens here
|
||||
// Warning: (231-245): Assertion violation happens here
|
||||
// Warning: (214-218): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (222-226): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (238-244): Assertion checker does not yet implement the type function (uint256) returns (uint256) for comparisons
|
||||
// Warning: (207-227): Assertion violation happens here
|
||||
// Warning: (231-245): Assertion violation happens here
|
||||
|
@ -10,5 +10,4 @@ contract B {
|
||||
}
|
||||
// ----
|
||||
// Warning: (162-184): Assertion violation happens here
|
||||
// Warning: (136-158): Assertion violation happens here
|
||||
// Warning: (162-184): Assertion violation happens here
|
||||
|
@ -1,4 +1,5 @@
|
||||
pragma experimental SMTChecker;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C
|
||||
{
|
||||
@ -8,24 +9,21 @@ contract C
|
||||
uint[][] memory cc,
|
||||
uint8[][] memory dd,
|
||||
uint[][][] memory eee
|
||||
) internal pure {
|
||||
require(a[0] == 2);
|
||||
require(cc[0][0] == 50);
|
||||
require(dd[0][0] == 10);
|
||||
require(eee[0][0][0] == 50);
|
||||
) public pure {
|
||||
a[0] = 2;
|
||||
cc[0][0] = 50;
|
||||
dd[0][0] = 10;
|
||||
eee[0][0][0] = 50;
|
||||
b[0] = 1;
|
||||
// Fails because b == a is possible.
|
||||
assert(a[0] == 2);
|
||||
// Fails because b == cc[0] is possible.
|
||||
assert(cc[0][0] == 50);
|
||||
// Fails because
|
||||
// b == a is possible
|
||||
// b == cc[0] is possible
|
||||
// b == ee[0][0] is possible
|
||||
assert(a[0] == 2 || cc[0][0] == 50 || eee[0][0][0] == 50);
|
||||
// Should not fail since knowledge is erased only for uint[].
|
||||
assert(dd[0][0] == 10);
|
||||
// Fails because b == ee[0][0] is possible.
|
||||
assert(eee[0][0][0] == 50);
|
||||
assert(b[0] == 1);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (345-362): Assertion violation happens here
|
||||
// Warning: (409-431): Assertion violation happens here
|
||||
// Warning: (571-597): Assertion violation happens here
|
||||
// Warning: (400-457): Assertion violation happens here
|
||||
|
@ -1,11 +1,12 @@
|
||||
pragma experimental SMTChecker;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C
|
||||
{
|
||||
uint[] array;
|
||||
function f(uint[] memory a, uint[] memory b) internal view {
|
||||
require(array[0] == 42);
|
||||
require(a[0] == 2);
|
||||
function f(uint[] memory a, uint[] memory b) public {
|
||||
array[0] = 42;
|
||||
a[0] = 2;
|
||||
b[0] = 1;
|
||||
// Erasing knowledge about memory references should not
|
||||
// erase knowledge about state variables.
|
||||
@ -15,4 +16,4 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (314-331): Assertion violation happens here
|
||||
// Warning: (321-338): Assertion violation happens here
|
||||
|
@ -1,12 +1,13 @@
|
||||
pragma experimental SMTChecker;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C
|
||||
{
|
||||
uint[] array;
|
||||
function f(uint[] memory a, uint[] memory b) internal view {
|
||||
require(array[0] == 42);
|
||||
function f(uint[] memory a, uint[] memory b) public {
|
||||
array[0] = 42;
|
||||
uint[] storage c = array;
|
||||
require(a[0] == 2);
|
||||
a[0] = 2;
|
||||
b[0] = 1;
|
||||
// Erasing knowledge about memory references should not
|
||||
// erase knowledge about state variables.
|
||||
@ -19,4 +20,4 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (469-486): Assertion violation happens here
|
||||
// Warning: (476-493): Assertion violation happens here
|
||||
|
@ -4,7 +4,9 @@ contract C
|
||||
{
|
||||
uint[] array;
|
||||
uint[][] array2d;
|
||||
uint[][][][] array4d;
|
||||
uint8[] tinyArray;
|
||||
uint8[][][] tinyArray3d;
|
||||
function f(
|
||||
uint[] storage a,
|
||||
uint[] storage b,
|
||||
@ -12,13 +14,13 @@ contract C
|
||||
uint8[][] storage dd,
|
||||
uint[][][] storage eee
|
||||
) internal {
|
||||
require(a[0] == 2);
|
||||
require(array[0] == 42);
|
||||
require(array2d[0][0] == 42);
|
||||
require(tinyArray[0] == 42);
|
||||
require(cc[0][0] == 42);
|
||||
require(dd[0][0] == 42);
|
||||
require(eee[0][0][0] == 42);
|
||||
a[0] = 2;
|
||||
array[0] = 42;
|
||||
array2d[0][0] = 42;
|
||||
tinyArray[0] = 42;
|
||||
cc[0][0] = 42;
|
||||
dd[0][0] = 42;
|
||||
eee[0][0][0] = 42;
|
||||
b[0] = 1;
|
||||
// Fails because b == a is possible.
|
||||
assert(a[0] == 2);
|
||||
@ -36,10 +38,19 @@ contract C
|
||||
assert(eee[0][0][0] == 42);
|
||||
assert(b[0] == 1);
|
||||
}
|
||||
|
||||
function g(uint a, uint b, uint c, uint d, uint e) public {
|
||||
f(array2d[a], array2d[b], array4d[c][c], tinyArray3d[d], array4d[e]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (489-506): Assertion violation happens here
|
||||
// Warning: (553-575): Assertion violation happens here
|
||||
// Warning: (627-654): Assertion violation happens here
|
||||
// Warning: (795-817): Assertion violation happens here
|
||||
// Warning: (957-983): Assertion violation happens here
|
||||
// Warning: (468-485): Assertion violation happens here
|
||||
// Warning: (532-554): Assertion violation happens here
|
||||
// Warning: (606-633): Assertion violation happens here
|
||||
// Warning: (774-796): Assertion violation happens here
|
||||
// Warning: (936-962): Assertion violation happens here
|
||||
// Warning: (468-485): Assertion violation happens here
|
||||
// Warning: (532-554): Assertion violation happens here
|
||||
// Warning: (606-633): Assertion violation happens here
|
||||
// Warning: (774-796): Assertion violation happens here
|
||||
// Warning: (936-962): Assertion violation happens here
|
||||
|
@ -2,9 +2,14 @@ pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
uint[][] array2d;
|
||||
function g(uint x, uint y, uint[] memory c) public {
|
||||
f(array2d[x], array2d[y], c);
|
||||
}
|
||||
|
||||
function f(uint[] storage a, uint[] storage b, uint[] memory c) internal {
|
||||
require(c[0] == 42);
|
||||
require(a[0] == 2);
|
||||
c[0] = 42;
|
||||
a[0] = 2;
|
||||
b[0] = 1;
|
||||
// Erasing knowledge about storage references should not
|
||||
// erase knowledge about memory references.
|
||||
@ -15,4 +20,5 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (347-364): Assertion violation happens here
|
||||
// Warning: (436-453): Assertion violation happens here
|
||||
// Warning: (436-453): Assertion violation happens here
|
||||
|
@ -2,10 +2,14 @@ pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
uint[][] array2d;
|
||||
function g(uint x, uint y, uint[] memory c) public {
|
||||
f(array2d[x], array2d[y], c);
|
||||
}
|
||||
function f(uint[] storage a, uint[] storage b, uint[] memory c) internal {
|
||||
uint[] memory d = c;
|
||||
require(c[0] == 42);
|
||||
require(a[0] == 2);
|
||||
c[0] = 42;
|
||||
a[0] = 2;
|
||||
b[0] = 1;
|
||||
// Erasing knowledge about storage references should not
|
||||
// erase knowledge about memory references.
|
||||
@ -19,4 +23,7 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (497-514): Assertion violation happens here
|
||||
// Warning: (524-542): Assertion violation happens here
|
||||
// Warning: (585-602): Assertion violation happens here
|
||||
// Warning: (524-542): Assertion violation happens here
|
||||
// Warning: (585-602): Assertion violation happens here
|
||||
|
@ -3,9 +3,10 @@ pragma experimental SMTChecker;
|
||||
contract C
|
||||
{
|
||||
uint[] array;
|
||||
uint[][] array2d;
|
||||
function f(uint[] storage a, uint[] storage b) internal {
|
||||
require(a[0] == 2);
|
||||
require(b[0] == 42);
|
||||
a[0] = 2;
|
||||
b[0] = 42;
|
||||
array[0] = 1;
|
||||
// Fails because array == a is possible.
|
||||
assert(a[0] == 2);
|
||||
@ -13,7 +14,12 @@ contract C
|
||||
assert(b[0] == 42);
|
||||
assert(array[0] == 1);
|
||||
}
|
||||
function g(uint x, uint y) public {
|
||||
f(array2d[x], array2d[y]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (226-243): Assertion violation happens here
|
||||
// Warning: (290-308): Assertion violation happens here
|
||||
// Warning: (225-242): Assertion violation happens here
|
||||
// Warning: (289-307): Assertion violation happens here
|
||||
// Warning: (225-242): Assertion violation happens here
|
||||
// Warning: (289-307): Assertion violation happens here
|
||||
|
@ -4,20 +4,29 @@ contract C
|
||||
{
|
||||
uint[] b;
|
||||
uint[] d;
|
||||
uint[][] array2d;
|
||||
function g(uint x, uint[] memory c) public {
|
||||
f(array2d[x], c);
|
||||
}
|
||||
function f(uint[] storage a, uint[] memory c) internal {
|
||||
require(d[0] == 42);
|
||||
require(c[0] == 42);
|
||||
require(a[0] == 2);
|
||||
d[0] = 42;
|
||||
c[0] = 42;
|
||||
a[0] = 2;
|
||||
b[0] = 1;
|
||||
// Erasing knowledge about storage variables should not
|
||||
// erase knowledge about memory references.
|
||||
assert(c[0] == 42);
|
||||
// Should not fail since b == d is not possible.
|
||||
// Fails because d == a is possible.
|
||||
assert(d[0] == 42);
|
||||
// Fails because b == a is possible.
|
||||
// Fails because b == a and d == a are possible.
|
||||
assert(a[0] == 2);
|
||||
// b == a is possible, but does not fail because b
|
||||
// was the last assignment.
|
||||
assert(b[0] == 1);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (446-463): Assertion violation happens here
|
||||
// Warning: (431-449): Assertion violation happens here
|
||||
// Warning: (504-521): Assertion violation happens here
|
||||
// Warning: (431-449): Assertion violation happens here
|
||||
// Warning: (504-521): Assertion violation happens here
|
||||
|
@ -7,9 +7,9 @@ contract C
|
||||
mapping (uint => uint8)[] severalMaps8;
|
||||
mapping (uint => uint)[][] severalMaps3d;
|
||||
function f(mapping (uint => uint) storage map) internal {
|
||||
require(severalMaps[0][0] == 42);
|
||||
require(severalMaps8[0][0] == 42);
|
||||
require(severalMaps3d[0][0][0] == 42);
|
||||
severalMaps[0][0] = 42;
|
||||
severalMaps8[0][0] = 42;
|
||||
severalMaps3d[0][0][0] = 42;
|
||||
map[0] = 2;
|
||||
// Should fail since map == severalMaps[0] is possible.
|
||||
assert(severalMaps[0][0] == 42);
|
||||
@ -18,7 +18,12 @@ contract C
|
||||
// Should fail since map == severalMaps3d[0][0] is possible.
|
||||
assert(severalMaps3d[0][0][0] == 42);
|
||||
}
|
||||
function g(uint x) public {
|
||||
f(severalMaps[x]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (451-482): Assertion violation happens here
|
||||
// Warning: (665-701): Assertion violation happens here
|
||||
// Warning: (421-452): Assertion violation happens here
|
||||
// Warning: (635-671): Assertion violation happens here
|
||||
// Warning: (421-452): Assertion violation happens here
|
||||
// Warning: (635-671): Assertion violation happens here
|
||||
|
@ -8,9 +8,9 @@ contract C
|
||||
mapping (uint => uint)[][] severalMaps3d;
|
||||
function f(mapping (uint => uint) storage map) internal {
|
||||
map[0] = 42;
|
||||
require(severalMaps[0][0] == 42);
|
||||
require(severalMaps8[0][0] == 42);
|
||||
require(severalMaps3d[0][0][0] == 42);
|
||||
severalMaps[0][0] = 42;
|
||||
severalMaps8[0][0] = 42;
|
||||
severalMaps3d[0][0][0] = 42;
|
||||
singleMap[0] = 2;
|
||||
// Should not fail since singleMap == severalMaps[0] is not possible.
|
||||
assert(severalMaps[0][0] == 42);
|
||||
@ -21,6 +21,10 @@ contract C
|
||||
// Should fail since singleMap == map is possible.
|
||||
assert(map[0] == 42);
|
||||
}
|
||||
function g(uint x) public {
|
||||
f(severalMaps[x]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (807-827): Assertion violation happens here
|
||||
// Warning: (777-797): Assertion violation happens here
|
||||
// Warning: (777-797): Assertion violation happens here
|
||||
|
@ -2,7 +2,7 @@ pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
function f(uint[2] memory a, uint[2] memory b, uint[2] memory c) internal pure {
|
||||
function f(uint[2] memory a, uint[2] memory b, uint[2] memory c) public pure {
|
||||
require(c[0] == 42);
|
||||
require(a[0] == 2);
|
||||
b[0] = 1;
|
||||
@ -14,5 +14,5 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (230-248): Assertion violation happens here
|
||||
// Warning: (295-312): Assertion violation happens here
|
||||
// Warning: (228-246): Assertion violation happens here
|
||||
// Warning: (293-310): Assertion violation happens here
|
||||
|
@ -2,18 +2,25 @@ pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
uint[2] b;
|
||||
uint[2] b1;
|
||||
uint[2] b2;
|
||||
function f(uint[2] storage a, uint[2] memory c) internal {
|
||||
require(c[0] == 42);
|
||||
require(a[0] == 2);
|
||||
b[0] = 1;
|
||||
c[0] = 42;
|
||||
a[0] = 2;
|
||||
b1[0] = 1;
|
||||
// Erasing knowledge about storage variables should not
|
||||
// erase knowledge about memory references.
|
||||
assert(c[0] == 42);
|
||||
// Fails because b == a is possible.
|
||||
// Fails because b1 == a is possible.
|
||||
assert(a[0] == 2);
|
||||
assert(b[0] == 1);
|
||||
assert(b1[0] == 1);
|
||||
}
|
||||
function g(bool x, uint[2] memory c) public {
|
||||
if (x) f(b1, c);
|
||||
else f(b2, c);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (342-359): Assertion violation happens here
|
||||
// Warning: (338-355): Assertion violation happens here
|
||||
// Warning: (338-355): Assertion violation happens here
|
||||
// Warning: (338-355): Assertion violation happens here
|
||||
|
@ -7,9 +7,9 @@ contract C
|
||||
mapping (uint => uint8)[2] severalMaps8;
|
||||
mapping (uint => uint)[2][2] severalMaps3d;
|
||||
function f(mapping (uint => uint) storage map) internal {
|
||||
require(severalMaps[0][0] == 42);
|
||||
require(severalMaps8[0][0] == 42);
|
||||
require(severalMaps3d[0][0][0] == 42);
|
||||
severalMaps[0][0] = 42;
|
||||
severalMaps8[0][0] = 42;
|
||||
severalMaps3d[0][0][0] = 42;
|
||||
map[0] = 2;
|
||||
// Should fail since map == severalMaps[0] is possible.
|
||||
assert(severalMaps[0][0] == 42);
|
||||
@ -18,7 +18,12 @@ contract C
|
||||
// Should fail since map == severalMaps3d[0][0] is possible.
|
||||
assert(severalMaps3d[0][0][0] == 42);
|
||||
}
|
||||
function g(uint x) public {
|
||||
f(severalMaps[x]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (455-486): Assertion violation happens here
|
||||
// Warning: (669-705): Assertion violation happens here
|
||||
// Warning: (425-456): Assertion violation happens here
|
||||
// Warning: (639-675): Assertion violation happens here
|
||||
// Warning: (425-456): Assertion violation happens here
|
||||
// Warning: (639-675): Assertion violation happens here
|
||||
|
@ -8,9 +8,9 @@ contract C
|
||||
mapping (uint => uint)[2][2] severalMaps3d;
|
||||
function f(mapping (uint => uint) storage map) internal {
|
||||
map[0] = 42;
|
||||
require(severalMaps[0][0] == 42);
|
||||
require(severalMaps8[0][0] == 42);
|
||||
require(severalMaps3d[0][0][0] == 42);
|
||||
severalMaps[0][0] = 42;
|
||||
severalMaps8[0][0] = 42;
|
||||
severalMaps3d[0][0][0] = 42;
|
||||
singleMap[0] = 2;
|
||||
// Should not fail since singleMap == severalMaps[0] is not possible.
|
||||
assert(severalMaps[0][0] == 42);
|
||||
@ -21,6 +21,10 @@ contract C
|
||||
// Should fail since singleMap == map is possible.
|
||||
assert(map[0] == 42);
|
||||
}
|
||||
function g(uint x) public {
|
||||
f(severalMaps3d[x][0]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (811-831): Assertion violation happens here
|
||||
// Warning: (781-801): Assertion violation happens here
|
||||
// Warning: (781-801): Assertion violation happens here
|
||||
|
@ -8,7 +8,7 @@ library L
|
||||
contract C
|
||||
{
|
||||
enum E { Left, Right }
|
||||
function f(E _d) internal pure {
|
||||
function f(E _d) public pure {
|
||||
_d = E.Left;
|
||||
assert(_d == E.Left);
|
||||
}
|
||||
|
@ -8,10 +8,10 @@ library L
|
||||
contract C
|
||||
{
|
||||
enum E { Left, Right }
|
||||
function f(E _d) internal pure {
|
||||
function f(E _d) public pure {
|
||||
_d = E.Right;
|
||||
assert(_d == E.Left);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (161-181): Assertion violation happens here
|
||||
// Warning: (159-179): Assertion violation happens here
|
||||
|
@ -1,19 +1,20 @@
|
||||
pragma experimental SMTChecker;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C
|
||||
{
|
||||
enum D { Left, Right }
|
||||
struct S { uint x; D d; }
|
||||
function f(S memory s) internal pure {
|
||||
function f(S memory s) public pure {
|
||||
s.d = D.Left;
|
||||
assert(s.d == D.Left);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (109-119): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (139-142): Assertion checker does not yet support this expression.
|
||||
// Warning: (139-140): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (139-151): Assertion checker does not yet implement such assignments.
|
||||
// Warning: (162-165): Assertion checker does not yet support this expression.
|
||||
// Warning: (162-163): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (155-176): Assertion violation happens here
|
||||
// Warning: (143-153): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (171-174): Assertion checker does not yet support this expression.
|
||||
// Warning: (171-172): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (171-183): Assertion checker does not yet implement such assignments.
|
||||
// Warning: (194-197): Assertion checker does not yet support this expression.
|
||||
// Warning: (194-195): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (187-208): Assertion violation happens here
|
||||
|
15
test/libsolidity/smtCheckerTests/types/fixed_bytes_2.sol
Normal file
15
test/libsolidity/smtCheckerTests/types/fixed_bytes_2.sol
Normal file
@ -0,0 +1,15 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
bytes32 x;
|
||||
function f(bytes8 y) public view {
|
||||
assert(x == g());
|
||||
assert(x != y);
|
||||
}
|
||||
function g() public view returns (bytes32) {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (116-130): Assertion violation happens here
|
@ -5,8 +5,9 @@ contract C
|
||||
mapping (uint => uint) a;
|
||||
mapping (uint => uint) b;
|
||||
|
||||
function f() public {
|
||||
require(a[1] == b[1]);
|
||||
function f(uint x) public {
|
||||
a[1] = x;
|
||||
b[1] = x;
|
||||
a[1] = 2;
|
||||
mapping (uint => uint) storage c = a;
|
||||
assert(c[1] == 2);
|
||||
@ -15,4 +16,4 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (261-281): Assertion violation happens here
|
||||
// Warning: (266-286): Assertion violation happens here
|
||||
|
@ -6,10 +6,10 @@ contract C
|
||||
mapping (uint => mapping (uint => uint)) maps;
|
||||
mapping (uint => mapping (uint => uint8)) maps8;
|
||||
function f(mapping (uint => uint) storage map1, mapping (uint => uint) storage map2) internal {
|
||||
require(map1[0] == 2);
|
||||
require(a[0] == 42);
|
||||
require(maps[0][0] == 42);
|
||||
require(maps8[0][0] == 42);
|
||||
map1[0] = 2;
|
||||
a[0] = 42;
|
||||
maps[0][0] = 42;
|
||||
maps8[0][0] = 42;
|
||||
map2[0] = 1;
|
||||
// Fails because map2 == map1 is possible.
|
||||
assert(map1[0] == 2);
|
||||
@ -21,8 +21,21 @@ contract C
|
||||
assert(maps8[0][0] == 42);
|
||||
assert(map2[0] == 1);
|
||||
}
|
||||
|
||||
function g(bool b, uint x, uint y) public {
|
||||
if (b)
|
||||
f(a, maps[y]);
|
||||
else
|
||||
f(maps[x], maps[y]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (437-457): Assertion violation happens here
|
||||
// Warning: (503-521): Assertion violation happens here
|
||||
// Warning: (573-597): Assertion violation happens here
|
||||
// Warning: (397-417): Assertion violation happens here
|
||||
// Warning: (463-481): Assertion violation happens here
|
||||
// Warning: (533-557): Assertion violation happens here
|
||||
// Warning: (397-417): Assertion violation happens here
|
||||
// Warning: (463-481): Assertion violation happens here
|
||||
// Warning: (533-557): Assertion violation happens here
|
||||
// Warning: (397-417): Assertion violation happens here
|
||||
// Warning: (463-481): Assertion violation happens here
|
||||
// Warning: (533-557): Assertion violation happens here
|
||||
|
@ -11,3 +11,4 @@ contract C {
|
||||
}
|
||||
// ----
|
||||
// Warning: (147-166): Assertion violation happens here
|
||||
// Warning: (170-190): Assertion violation happens here
|
||||
|
@ -15,3 +15,4 @@ contract C
|
||||
}
|
||||
// ----
|
||||
// Warning: (182-196): Assertion violation happens here
|
||||
// Warning: (200-214): Assertion violation happens here
|
||||
|
@ -17,3 +17,4 @@ contract C
|
||||
}
|
||||
// ----
|
||||
// Warning: (205-219): Assertion violation happens here
|
||||
// Warning: (223-237): Assertion violation happens here
|
||||
|
@ -3,7 +3,7 @@
|
||||
{
|
||||
"smtlib2responses":
|
||||
{
|
||||
"0x82fb8ee094f0f56b7a63a74177b54a1710d6fc531d426f288c18f36b76cf6a8b": "sat\n((|EVALEXPR_0| 1))\n",
|
||||
"0x9c50514d749eabf3c13d97ad7d787e682dd99a114bad652b10a01b8c6ad6c1fb": "sat\n((|EVALEXPR_0| 1))\n",
|
||||
"0xb524e7c577188e2e36f0e67fead51269fa0f8b8fb41bff2d973dcf584d38cd1e": "sat\n((|EVALEXPR_0| 0))\n"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user