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

Bad interaction between unused variable elimination and "let x = if ... in" hoisting #291

Open
R1kM opened this issue Sep 23, 2022 · 1 comment

Comments

@R1kM
Copy link
Collaborator

R1kM commented Sep 23, 2022

This issue is based on the following comment in one of the HACL PRs: hacl-star/hacl-star#611 (comment)

The problematic code has the shape
let c = BN.bn_add args in Ghost.hide c, where bn_add is inline_for_extraction, and consists of an if_then_else statement.

After extraction, the resulting code has shape

uint64_t c1;
if e {
  use of c0
} else {
  use of c0
}
c1 = c0;
return;

As far as I understand, c1 is introduced as a temporary variable to handle let c = if e then .. else ... in, but is not used afterwards. It could be removed as part of an unused variable elimination pass.

@msprotz
Copy link
Contributor

msprotz commented Oct 12, 2023

This might be improved by the recent fix to unused variable elimination. @R1kM can you tell me whether this is still valid?

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