[all-commits] [llvm/llvm-project] fd7efe: [analyzer] Fix cast evaluation on scoped enums in ...
Balazs Benics via All-commits
all-commits at lists.llvm.org
Mon May 2 01:56:20 PDT 2022
Author: Balazs Benics <balazs.benics at sigmatechnology.se>
Date: 2022-05-02 (Mon, 02 May 2022)
[analyzer] Fix cast evaluation on scoped enums in ExprEngine
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. 8 bits
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
Fixes #47570 #43375
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D85528
More information about the All-commits