Skip to content

Incorrect order in YUL inliner #117

@TorstenStueber

Description

@TorstenStueber

Given the following contract:

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

contract InnerContract {
    uint256 public innerConstructedStartTokenId;

    constructor() {
        innerConstructedStartTokenId = _startTokenId();
    }

    function _startTokenId() internal view virtual returns (uint256) {
        return 0;
    }
}

contract Test is InnerContract {
    uint256 public START_TOKEN_ID = 1;

    constructor() InnerContract() {
    }

    function _startTokenId() internal view virtual override returns (uint256) {
        return START_TOKEN_ID;
    }
}

The return value of the function innerConstructedStartTokenId of the contract Test is 0, although it should be 1.

This issue disappears when return START_TOKEN_ID; is replaced with return 1;.

It seems that this is due to the YUL inliner that violates the order of statements.

Metadata

Metadata

Assignees

Labels

PVMProblem occurs at the execution stage for PVMbugerror: CompilerProblem occurs at the compiling stage

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions