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

'nsw' in smaddl leads to poison #656

Open
katrinafyi opened this issue Feb 21, 2023 · 1 comment
Open

'nsw' in smaddl leads to poison #656

katrinafyi opened this issue Feb 21, 2023 · 1 comment

Comments

@katrinafyi
Copy link

For an instruction like 200c229b smaddl x0, w1, w2, x3, the LLVM IR has "nsw" flags:

  // ...
  %mul.i.i = mul nsw i64 %conv.i31.i, %conv.i29.i
  %add.i.i = add nsw i64 %mul.i.i, %8
  store i64 %add.i.i, ptr %X0, align 8

For mul, this is fine as both operands are 32-bit, but the addition can easily overflow. For example, w1 = w2 = 1 and x3 = MAX_INT will cause a poison value to be returned.

@thug-shaker

This comment was marked as abuse.

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