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

SimplExpr: revised handling of nested conditional, ||, && expressions #458

Merged
merged 2 commits into from
Oct 24, 2022

Conversation

xavierleroy
Copy link
Contributor

In a For_set destination, a temporary can be reused only if it always used with the same type. Otherwise, typing of Cminor code fails later in the compilation pipeline.

This commit implements temporary reuse if and only if the typing constraint is respected.

  • For && and ||, it avoids the possibility of wrong reuse (as reported in bad definition/use of variable error #453)
  • For nested conditional expressions, it improves a bit the generated code by reusing the temporary when possible.

Fixes: #453

In a `For_set` destination, a temporary can be reused only if it
always used with the same type. Otherwise, typing of Cminor code fails
later in the compilation pipeline.

This commit implements temporary reuse if and only if the typing
constraint is respected.
- For `&&` and `||`, it avoids the possibility of wrong reuse
  (as reported in #453).
- For nested conditional expressions, it improves a bit the generated
  code by reusing the temporary when possible.

Fixes: #453
@xavierleroy xavierleroy merged commit 3d6c498 into master Oct 24, 2022
@xavierleroy xavierleroy deleted the simpl-expr-dests branch October 24, 2022 09:05
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

Successfully merging this pull request may close these issues.

bad definition/use of variable error
1 participant