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

Slither crashes generating SSA with array of size 1 specified by literal #143

Closed
Xenomega opened this issue Jan 16, 2019 · 0 comments
Closed
Labels
bug Something isn't working
Milestone

Comments

@Xenomega
Copy link
Member

The following contract will cause slither to throw an error:

contract C {
    function f() public {
        uint8[1] memory x = [ 77 ];
    }
}

It seems creating an array with size 1, with the single element specified by a literal causes slither to fail to generate SSA. If the element is specified as a variable in the array, it will not throw an error. This was also tested with a bool[1] memory x = [ false ]; and threw an error as well.

Stack trace:

ERROR:root:Traceback (most recent call last):
  File "c:\users\vyper\documents\github\slither\slither\solc_parsing\slitherSolc.py", line 341, in _convert_to_slithir
    contract.convert_expression_to_slithir()
  File "c:\users\vyper\documents\github\slither\slither\solc_parsing\declarations\contract.py", line 386, in convert_expression_to_slithir
    func.generate_slithir_ssa(all_ssa_state_variables_instances)
  File "c:\users\vyper\documents\github\slither\slither\solc_parsing\declarations\function.py", line 935, in generate_slithir_ssa
    add_ssa_ir(self, all_ssa_state_variables_instances)
  File "c:\users\vyper\documents\github\slither\slither\slithir\utils\ssa.py", line 123, in add_ssa_ir
    [])
  File "c:\users\vyper\documents\github\slither\slither\slithir\utils\ssa.py", line 295, in generate_ssa_irs
    visited)
  File "c:\users\vyper\documents\github\slither\slither\slithir\utils\ssa.py", line 285, in generate_ssa_irs
    new_ir.lvalue.add_refers_to(new_ir.rvalue)
  File "c:\users\vyper\documents\github\slither\slither\slithir\variables\local_variable.py", line 56, in add_refers_to
    self._refers_to.add(variable)
TypeError: unhashable type: 'Constant'
@montyly montyly added the bug Something isn't working label Jan 17, 2019
@montyly montyly added this to the 0.6.0 milestone Jan 28, 2019
@montyly montyly closed this as completed Feb 5, 2019
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