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

Post-incrementing native integers across overflow boundary #2541

Open
lucasbuchala opened this issue Dec 13, 2018 · 3 comments
Open

Post-incrementing native integers across overflow boundary #2541

lucasbuchala opened this issue Dec 13, 2018 · 3 comments
Labels
native types anything related to signed or unsigned native ints, or num, or str optimizer

Comments

@lucasbuchala
Copy link
Collaborator

Post-incrementing native integers across overflow boundary gives wrong answer. My expectation is that $x++ should evaluate to the same value of $x before the operation.

> say my int8 $x = 127; say $x++; say $x
127
-129
-128

> say my int16 $x = 32767; say $x++; say $x
32767
-32769
-32768

This is Rakudo version 2018.11 built on MoarVM version 2018.11

@lizmat
Copy link
Contributor

lizmat commented Dec 31, 2018

Thanks for your report.

To my knowledge, this behaviour is intentional with regards to native integer variables. I'm therefore closing this issue. Please re-open if you disagree.

@lizmat lizmat closed this as completed Dec 31, 2018
@lizmat lizmat reopened this Jan 9, 2019
@lizmat
Copy link
Contributor

lizmat commented Jan 9, 2019

This appears to be an optimizer issue:

$ perl6 -e 'my int8 $a = 127; say $a++'
-129

perl6 --optimize=0 -e 'my int8 $a = 127; say $a++'
127

@lizmat
Copy link
Contributor

lizmat commented Jan 9, 2019

Simply removing the optimization in the static optimizer, breaks spectests.

OTOH, this problem has been around since at least Christmas 2015, so it looks like it's not a very common occurrence. So I don't need to see a need to add a blocker label just yet.

@lucasbuchala lucasbuchala added native types anything related to signed or unsigned native ints, or num, or str optimizer labels Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
native types anything related to signed or unsigned native ints, or num, or str optimizer
Projects
None yet
Development

No branches or pull requests

2 participants