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

solc-verify reports mismatched types #147

Closed
zhao-nan opened this issue Jun 23, 2020 · 7 comments
Closed

solc-verify reports mismatched types #147

zhao-nan opened this issue Jun 23, 2020 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@zhao-nan
Copy link

Description

When calling solc-verify.py on the example code below, it gives an error message:
out/Err.sol.bpl(37,1): Error: mismatched types in assignment command (cannot assign int_arr_type to int_arr_ptr)

pragma solidity >=0.5.0 <0.6.0;

contract Thing {
    string public id;
}

contract otherThing {
    function f(Thing t)
        public view returns(string memory)
    {
        string memory s = t.id();
        return s;
    }
}

The solc compiler does not give any errors or warnings. Therefore, I think this is a bug.
I also came across the very similar Error: invalid type for argument 0 in map select: int_arr_type (expected: int_arr_ptr)

Environment

  • Compiler version: 0.5.17-develop.2020.6.23+commit.04e0b152.Linux.g++
  • Operating system: Ubuntu 18.04
@hajduakos
Copy link
Member

Thanks for reporting! To me it seems like this is related to #123, namely not handling strings properly when passed around or returned.

@dddejan
Copy link
Member

dddejan commented Jul 24, 2020

#123 is related to string literals (which are not arrays). The issue here is that the getter function .id() is currently modeled as directly giving the contract member (storage). In reality, for non-value types, the getters will return the corresponding memory version.

@dddejan dddejan added the bug Something isn't working label Jul 24, 2020
@zhao-nan
Copy link
Author

zhao-nan commented Oct 9, 2020

Is this likely to be fixed at some point? We're doing a smart contract verification case study. For some parts, solc-verify would be the obvious choice and should work very well (judging from my experience), but at present this bug prevents us from using it.

@hajduakos
Copy link
Member

hajduakos commented Oct 16, 2020

@zhao-nan I will check. I think we need to do some conversion around here

@hajduakos hajduakos self-assigned this Oct 16, 2020
@hajduakos
Copy link
Member

@zhao-nan was fixed in bc1465b

I'm gonna leave the issue open, because we also have to port this fix to the 0.7 branch

@hajduakos
Copy link
Member

Fixed on 0.7 as well. @zhao-nan can you please check and close the issue if it works? I've added your example as Issue147.sol

@zhao-nan
Copy link
Author

Everything working now. Great, thanks!

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

3 participants