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
Bitwise operators OR and AND are not working with -(2^63 - 1) in 3.2.3 [regression]
#42289
Comments
-(2^63 - 1) in 3.2.3. Were working in 3.2.2.
Indeed the issue seems to be that -9223372036854775808 is parsed as The same issue happens in 3.2.2 too if you use actual hexadecimal notation, which makes those magic numbers somewhat easier to parse. |
-(2^63 - 1) in 3.2.3. Were working in 3.2.2.-(2^63 - 1) in 3.2.3 [regression]
|
It's also reproducible in the In Probably caused by #40009 / #40149 (@mrushyendra).
To clarify, that one is a pre-existing bug not caused by the above PRs. But that's also something that should be fixed eventually. |
|
If I'm understanding correctly, it seems like the issue is not with the changes in #40009 itself, but due to |
|
Yeah I think this might need to be fixed in the GDScript parser so that it calls This would fix both the current "regression" and the pre-existing bug when using CC @godotengine/gdscript |
|
This is somewhat of an argument in favor of handling negative number literals in the tokenizer, but it can lead to the problem of parsing expressions like |
Godot version:
3.2.3
OS/device including version:
Windows 10, 2004
Issue description:
Bitwise operators OR and AND aren't working 100% correctly in version 3.2.3, but were working in 3.2.2.
I didn't test XOR.
Steps to reproduce:
If I want to set bit 63 on a 64-bit int using:
var value:int = 0 | -9223372036854775808
I get -9223372036854775807 which is wrong
Godot just set bit 63 and bit 0!
Likewise, if I want to test for bit 63:
var value:int = -1 & -9223372036854775808
I get again -9223372036854775807 which is wrong
Godot tested bit 63 and bit 0!
(I also tested with Python, just to be sure)
Possibly related, I repeatedly see on the console while editing:
ERROR: Cannot represent 9223372036854775808 as 64-bit integer, provided value is too big.
At: core/ustring.cpp:1821
Which is actually correct. However, I don't have that number anywhere in code. Well, I do have that number, but negative. The parser seems to be ignoring the minus sign.
My hunch is that "-9223372036854775808" is being incorrectly parsed, leading to incorrect bitwise operations.
Minimal reproduction project:
The text was updated successfully, but these errors were encountered: