Skip to content

Fix placement of _Assume_bounds_cast on c-style cast #447

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

Merged
merged 1 commit into from
Feb 26, 2021

Conversation

john-h-kastner
Copy link
Collaborator

The if statement that tries to replace an existing cast with a new cast
assumed that the new cast was a c-style cast and not a CheckedC
bounds cast. If the branch was taken when inserting a bounds cast,
the leading '_' was cut off, resulting in invalid code. This commit
adds a condition that ensures this does not happen.

I added an assert for this invariant in one of the PRs I merged earlier
today, but somehow didn't see the obvious way that it can be violated.

The branch that tries to replace an existing cast with a new cast
assumed it that the new cast was a c-style cast and not a CheckedC
bounds cast. If the branch was taken when inserting a bounds cast,
the leading '_' was cut off, resulting in invalid code. This commit
adds a condition that ensures this does not happen.
@john-h-kastner john-h-kastner merged commit 443c757 into main Feb 26, 2021
@john-h-kastner john-h-kastner deleted the cast_placement_fix branch March 9, 2021 15:40
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.

1 participant