Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verisol crashes on contracts with array allocation #195

Open
fredfeng opened this issue Sep 27, 2019 · 2 comments
Open

Verisol crashes on contracts with array allocation #195

fredfeng opened this issue Sep 27, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@fredfeng
Copy link

Execute Verisol with a simple contract that contains a new statement:

dotnet Binaries/VeriSol.dll C1-buggy.sol C1 /omitSourceLineInfo /omitDataValuesInTrace /omitAxioms /omitHarness /omitUnsignedSemantics

Expected: Generate the right .BPL file.

Got:

Command line args ==> /Users/yufeng/research/LoopSum/examples/C1-buggy.sol, C1, /omitSourceLineInfo, /omitDataValuesInTrace, /omitAxioms, /omitHarness, /omitUnsignedSemantics
SpecFilesDir = /Users/yufeng/research/LoopSum/examples

++ Running Solc on /Users/yufeng/research/LoopSum/examples/C1-buggy.sol....
C1-buggy.sol:14:21: TypeError: Type address is not implicitly convertible to expected type uint256.
	      tempLockTime[_address][i] = lockTime[_address][i] + later-earlier;
	                   ^------^

C1-buggy.sol:14:8: TypeError: Indexed expression has to be a type, mapping or array (is uint256)
	      tempLockTime[_address][i] = lockTime[_address][i] + later-earlier;
	      ^--------------------^

Here is C1-buggy.sol:

pragma solidity ^0.5.10;

contract C1 {

    mapping (address => uint256[]) private lockTime;
    mapping (address => uint256) private lockNum;
    uint later = 1;
    uint earlier = 2;

    function foo(address _address) public {

        uint256[] memory tempLockTime = new uint256[](lockNum[_address]);
	for (uint i = 0; i < lockNum[_address]; ++i) {
	      tempLockTime[_address][i] = lockTime[_address][i] + later-earlier;
	}

    }
}
@shuvendu-lahiri shuvendu-lahiri added the bug Something isn't working label Sep 27, 2019
@shuvendu-lahiri
Copy link
Member

shuvendu-lahiri commented Sep 27, 2019

Thanks. There is indeed a problem with new T allocations, when T is of type array.

However, the error showsn above are errors from Solidity compiler. Can you fix the example so we see the VeriSol translation error?

@shuvendu-lahiri shuvendu-lahiri changed the title Verisol crashes on contracts with new statements Verisol crashes on contracts with array allocation Oct 12, 2019
shuvendu-lahiri added a commit that referenced this issue Apr 13, 2020
@shuvendu-lahiri
Copy link
Member

shuvendu-lahiri added a commit that referenced this issue Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants