Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Debugger shows incorrect value for a Yul variable #6157

Open
cds-amal opened this issue Jul 27, 2023 · 4 comments
Open

Debugger shows incorrect value for a Yul variable #6157

cds-amal opened this issue Jul 27, 2023 · 4 comments

Comments

@cds-amal
Copy link
Member

cds-amal commented Jul 27, 2023

While evaluating #6154 I noticed this strange behavior where the expected value for a variable should be 0, but we get 1.

Steps to Reproduce

  1. Clone this Repo
  2. truffle develop
  3.  truffle(develop) migrate
     D = await DelegateTestYulString.deployed()
     await D.setValue("Hello")
     // grab transaction hash
  4. In a separate terminal console:
    truffle debug --url http://127.0.0.1:9545 txhash
    b YulString.yul:179
    c
    :v
    # expect 0, but got 1

Environment

@haltman-at
Copy link
Contributor

Hm, yeah, looks like the debugger is getting wrong the stack slots for Yul return variables. Will have to see just what's going on there. Oy, like that code isn't hairy enough already...!

@haltman-at
Copy link
Contributor

Hm, this is very annoying. It looks like the problem is due to the optimizer -- it'll run on straight Yul code where it wouldn't on a Solidity assembly block. Even if you set enabled: false, even if you set yul: false, it'll still do it. The only way I found to turn it off was to set yul: true (!), and then use yulDetails to turn everything off. Once you do that, things work fine. :-/

Since it's due to the optimizer, I'm not sure if I can do much about this; but it's very annoying because, like, the optimizer is basically going to always be on in this case! Ugh...

@haltman-at
Copy link
Contributor

(Maybe should file an issue with Solidity about this...? Or at least go ask them about it...)

@cds-amal
Copy link
Member Author

(Maybe should file an issue with Solidity about this...? Or at least go ask them about it...)

Seems like a good idea to raise it with them. Can you do that please?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants