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

Strange unsigned compare #1129

Open
rfalke opened this issue Jan 7, 2022 · 0 comments
Open

Strange unsigned compare #1129

rfalke opened this issue Jan 7, 2022 · 0 comments

Comments

@rfalke
Copy link

rfalke commented Jan 7, 2022

Version: 9a281a1

Subject: https://github.com/rfalke/decompiler-subjects/blob/master/from_holdec/branchless_arithmetic/arm64_macho/by_reko.c

Source:

u64b __attribute__((noinline)) sat_addu64b(u64b x, u64b y) {
  u64b res = x + y;
  res |= -(res < x);

  return res;
}

Output:

word64 _sat_addu64b(word64 x0, word64 x1)
{
	up64 x8_5 = x0 + x1;
	return x8_5 < 0x00 ? x8_5 : ~0x00;
}

I couldn't find a definition of up64 but I assume it is unsigned. But than x8_5 < 0x00 doesn't make sense.

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

1 participant