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

Incorrect transforms for -hack-scf #1041

Open
alan-baker opened this issue Mar 17, 2023 · 0 comments
Open

Incorrect transforms for -hack-scf #1041

alan-baker opened this issue Mar 17, 2023 · 0 comments
Labels

Comments

@alan-baker
Copy link
Collaborator

Recently uncovered this testing abs_diff. The transformations in the pass are not safe if overflow occurs. For example signed greater than (a > b) is implemented as:

%sub = sub i32 %a, %b
%sub1 = sub i32 %sub, 1
%and = and i32 %sub1, 0x80000000
%eq = OpIEqual i32 %and, 0

Here is a problematic 8-bit case:

a = 0x7f
b = 0x8f
%sub = 0xf0
%sub1 = 0xef
%and = 0x80
%eq = false

The transform needs to handle more cases in case of potential wrapping.

@alan-baker alan-baker added the bug label Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant