Skip to content

[Bug]: fixed-size array return values are unpacked unexpectedly in IR #1827

Open
@Troublor

Description

@Troublor

Describe the issue:

When the return value of a function is a fix-sized array, and an array literal is returned, SlithIR will unpack the array literal, returning every element in the array literal.
For the example given below, the function only returns two values, one is a fixed-size array, and the other is a uint.
However, in the IR, the return operation has three arguments.
The array return value is unpacked unexpectedly.

Code example to reproduce the issue:

contract Contract {
    function foo() public returns (uint[2] memory, uint) {
        return ([uint(1), 2], 3);
    }
}

Version:

0.9.3

Relevant log output:

INFO:Printers:Contract Contract
        Function Contract.foo() (*)
                Expression: ((uint256(1),2),3)
                IRs:
                        TMP_0 = CONVERT 1 to uint256
                        RETURN TMP_0,2,3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingir

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions