crytic / crytic/slither

[Bug]: Free functions are not considered when printing IR in SSA-form

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

Description

### What happened?

When printing slithIR in SSA form (`--print slithir-ssa`) free functions are not included in the output.
Using the regular IR-printer (`--print slithir`) it produces output for free functions.

In the code example below, I am expecting the square function to be printed in SSA form, however it is not.

### Can you share code with us to reproduce this bug?

```solidity
pragma solidity ^0.8.11;

function square(uint val) pure returns(uint) {
return val * val;
}

contract A {}
```

### Version

0.8.2

### Relevant log output
Failing:
```shell
slither contract.sol --print slithir-ssa
ERROR:Slither:File slither.config.json is not a file or does not exist
ERROR:Slither:Falling back to the default settings...
Compilation warnings/errors on contract.sol:
Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
--> contract.sol

Contract Bug

contract.sol analyzed (1 contracts)
```

Working (no SSA):
```shell
slither contract.sol --print slithir-ssa
ERROR:Slither:File slither.config.json is not a file or does not exist
ERROR:Slither:Falling back to the default settings...
Compilation warnings/errors on contract.sol:
Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
--> contract.sol

Contract Bug
Top level functions Function square(uint256)
Expression: val * val
IRs:
TMP_0(uint256) = val (c)* val
RETURN TMP_0

contract.sol analyzed (1 contracts)
```

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.