crytic / crytic/slither

[Bug]: In IR, literal 0 has type uint256 even in contexts expecting bytes32

Open
#1,931 1 comment 0 reactions 0 assignees View on GitHub
bug ir
Dominant language
Python
Stars
6.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

### Describe the issue:

In IR, when the literal 0 is used in a context where a fixed-length bytes type is expected, it is given type `uint256`. The results in, for example, assignments where the left-hand side has type `bytes32` and the right-hand side has type `uint256`.

### Code example to reproduce the issue:

```
contract Test {
function test() external {
bytes32 a = 0;
}
}
```

### Version:

0.9.3

### Relevant log output:

```shell
INFO:Printers:Contract Test
Function Test.test() (*)
Expression: a = 0
IRs:
a(bytes32) := 0(uint256)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.