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

Generating an invert operation for boolean xor is invalid in most contexts due to integer promotion #192

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

bcoppens
Copy link
Contributor

The problem with generating ~(boolean_var) for a 'not' pattern match is that, in the context of an if-statement, this results in if (~(boolean_var)). However, ~ promotes it to an integer. In case boolean_var is true, this operation thus results in a value of 111111[...]110, which evaluates to true, not false.

This isn't noticeable when the end result is immediately returned from a function as an i1 itself; but in cases where the end result is used in an if-statement it is incorrect.

By removing this pattern match, xor is just used for the code generation, which does work in this case.

@vtjnash vtjnash merged commit 0d5276c into JuliaHubOSS:master Jan 16, 2024
3 checks passed
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.

2 participants