Skip to content
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

Operator precedence gets messed up when using bitwise operators on bitlib mode #137

Open
Lyrth opened this issue Nov 25, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Lyrth
Copy link

Lyrth commented Nov 25, 2023

There are no operator precedence rules followed when transforming bitwise operations into bitlib function calls when using --bitwise library or equivalent. The below code

print( ~2 & a == 4 * b )

will be compiled into

print(bit.bnot(bit.band(2, a==4*b)));

which would be wrong.

@Maiori44 Maiori44 added the bug Something isn't working label Nov 25, 2023
@Maiori44 Maiori44 self-assigned this Nov 25, 2023
@Maiori44 Maiori44 added this to the 4.0 milestone Nov 25, 2023
@Maiori44
Copy link
Member

since this can be avoided by using ()s, I'll fix it for 4.0 rather than do a patch.

@Maiori44 Maiori44 removed this from the 4.0 milestone Nov 30, 2023
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
Status: Todo
Development

No branches or pull requests

2 participants