crytic / crytic/slither

Return parameters of primitive types are assigned the storage location "memory"

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

Description

### Describe the issue:

In Slither's "solc parsing" code, parameters without explicit locations are [assigned the location `"memory"`](https://github.com/crytic/slither/blob/0ec487460690482c72cacdea6705e2c51bb3981e/slither/solc_parsing/declarations/function.py#L1174-L1175).

I think this is incorrect. The problem is that it assigns the `"memory"` location even to primitive types such as `uint`. I don't think it makes sense to associate a location with a primitive type. This makes it difficult to obtain the storage locations of a function's return values.

It cites [official solidity documentation](https://solidity.readthedocs.io/en/v0.4.24/types.html?highlight=storage%20location#data-location), but I believe this documentation is out of date. Now solc forces the developer to provide an explicit memory location with every complex-typed parameter.

### Code example to reproduce the issue:

This is not user-visible issue.

### Version:

0.9.3

### Relevant log output:

_No response_

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.