10000 Unary expressions clobber deferred slots · Issue #838 · rune-rs/rune · GitHub
[go: up one dir, main page]

Skip to content

Unary expressions clobber deferred slots #838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jie-huangfu opened this issue Oct 25, 2024 · 2 comments · Fixed by #839
Closed

Unary expressions clobber deferred slots #838

jie-huangfu opened this issue Oct 25, 2024 · 2 comments · Fixed by #839
Labels
bug Something isn't working

Comments

@jie-huangfu
Copy link
jie-huangfu commented Oct 25, 2024

run the following in the Playground, and got Output "false \n true". What would be the reason?

pub fn main() {
    let a = 2;
    let b = -5;
    dbg!(a > -b);
    dbg!(a > -b);
}
@udoprog
Copy link
Collaborator
udoprog commented Oct 26, 2024

Probably a miscompilation with the new assembler like #830

Thanks for the report!

@udoprog udoprog added the bug Something isn't working label Oct 26, 2024
@udoprog
Copy link
Collaborator
udoprog commented Oct 26, 2024

Enabling instructions reveals that the variable slot is being clobbered when bending instead of using a temporary:

# instruction fn main() (0x1c69d5964e831fc1):
  0000 = allocate size=3
  0001 = store value=2, out=keep(0)
  entry:2:13-14: let a = 2;
  0002 = store value=-5, out=keep(1) 
  entry:3:13-15: let b = -5;
  0003 = neg addr=1, out=keep(1) // this writes to `b` instead of its own slot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0