solidity icon indicating copy to clipboard operation
solidity copied to clipboard

Overridden virtual functions: internal compile error.

Open michael-emmi opened this issue 5 years ago • 4 comments

It seems that overriding an inherited virtual function causes a crash!

Not clear whether this is something you want to deal with, since (a) this example also crashes solc, and (b) there are probably other practical ways of avoiding the verification of A.f — other than deleting its body.

$ cat a.sol && solc-verify.py a.sol 
pragma solidity ^0.5.0;

contract A {
    int x;

    /// @notice postcondition x == 0
    function f() internal;
}

contract B is A {
    function f() internal { }

    /// @notice postcondition x == 0;
    function g() public { A.f(); }
}
Error while running compiler, details:
Internal compiler error during compilation:
/Users/mje/Code/solidity-boogie/libsolidity/codegen/ContractCompiler.cpp(1036): Throw in function void dev::solidity::ContractCompiler::appendModifierOrFunctionCode()
Dynamic exception type: boost::wrapexcept<langutil::InternalCompilerError>
std::exception::what: 
[dev::tag_comment*] = 

michael-emmi avatar Aug 15 '19 20:08 michael-emmi

@michael-emmi did you report this upstream?

dddejan avatar Aug 18 '19 16:08 dddejan

I have not yet. I have seen a related issue ethereum/solidity#5130 which was fixed in ethereum/solidity#5558 in December, but I haven’t determined whether the code we’re using includes ethereum/solidity#5558.

michael-emmi avatar Aug 19 '19 15:08 michael-emmi

i added a comment to ethereum#5130, it's basically the same issue but the fix missed this case

dddejan avatar Aug 21 '19 18:08 dddejan

Tracked in https://github.com/ethereum/solidity/issues/7314

chriseth avatar Aug 28 '19 15:08 chriseth