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

Undefined behavior negating minimum int64_t value #96

Open
jandem opened this issue May 22, 2024 · 3 comments
Open

Undefined behavior negating minimum int64_t value #96

jandem opened this issue May 22, 2024 · 3 comments

Comments

@jandem
Copy link

jandem commented May 22, 2024

There are a few places where the aarch64 code uses -operand.immediate(). If the immediate is INT64_MIN, the behavior is undefined.

This was fixed for Add and Sub in 2020 in b8da04d, but the same pattern still shows up in Ccmp, Ccmn, and Neg.

We (Mozilla) ran into this because our fork didn't have the fix for Add and Sub and it was causing problems with recent Clang versions, but we then noticed the same pattern is still present in these other methods.

@mmc28a
Copy link
Collaborator

mmc28a commented May 23, 2024

Thanks for the report. Agreed about the missing cases - I'll put together a fix.

@jandem
Copy link
Author

jandem commented May 29, 2024

For what it's worth, this is the patch I wrote but our code bases have diverged some: https://hg.mozilla.org/mozilla-central/rev/95db18f53141

@mmc28a
Copy link
Collaborator

mmc28a commented Jun 14, 2024

CR #99 refactors the existing code and should fix the remaining cases.

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

No branches or pull requests

2 participants