Skip to content

Backport [analyzer] Fix cast evaluation on scoped enums in ExprEngine #289

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

Closed
wants to merge 1 commit into from
Closed

Backport [analyzer] Fix cast evaluation on scoped enums in ExprEngine #289

wants to merge 1 commit into from

Conversation

steakhal
Copy link
Contributor

It will prevent crashes during bugreport refutation.

We ignored the cast if the enum was scoped.
This is bad since there is no implicit conversion from the scoped enum to the
corresponding underlying type.

The fix is basically:
  `isIntegralOrEnumerationType()` ->
  `isIntegralOr**Unscoped**EnumerationType()`

This materialized in crashes on analyzing the LLVM itself using the Z3
refutation. Refutation synthesized the given Z3 Binary expression
(BO_And of unsigned char aka. 8bits and an int 32 bits) with the wrong
bitwidth in the end, which triggered an assert.

Now, we evaluate the cast according to the standard.

This bug could have been triggered using the Z3 CM according to
https://bugs.llvm.org/show_bug.cgi?id=44030

Reviewed By: TODO

Differential Revision: https://reviews.llvm.org/D85528
@repo-lockdown
Copy link

repo-lockdown bot commented Jan 22, 2021

This repository does not accept pull requests. Please follow http://llvm.org/docs/Contributing.html#how-to-submit-a-patch for contribution to LLVM.

@repo-lockdown repo-lockdown bot closed this Jan 22, 2021
@repo-lockdown repo-lockdown bot locked and limited conversation to collaborators Jan 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant