-
Notifications
You must be signed in to change notification settings - Fork 13.4k
alpha.core.BoolAssignment
causes failure of assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!")
at APSInt.h:179
#111147
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
Comments
@llvm/issue-subscribers-clang-static-analyzer Author: Donát Nagy (NagyDonat)
Apparently the analyzer mixes signed and unsigned `APSInt` values in a `<=` comparison which causes an assertion failure. I found this issue while analyzing a preprocessed version of `unicode.c` from the ruby project, but it was easy to extract a short reproducer: https://github.com/Ericsson/llvm-project/commit/b1e4ddbfad5baa1ba243a38653aa8c39715371b0
This bug is probably introduced by the recent changes to |
FYI I could not get the assertion failure even on main. |
The relevant parts of the stack dump look like
(I stripped lots of cruft, including hexadecimal garbage and |
That's very strange. I rebased Ericsson@b1e4ddb to current main (although it's already on a slightly earlier main version from today) and on my system building |
nvm, reproduces. I just forgot to rebase :D I only fetched main. |
Will take a look (likely on Monday). Thanks for the report! |
So I found a problem. On the other hand, |
`builtin_*_overflow` functions return `_Bool` according to [1]. `BuiltinFunctionChecker` was using `makeTruthVal` w/o specifying explicit type, which creates an `int` value, since it's the type of any compassion according to C standard. Fix it by directly passing `BoolTy` to `makeTruthVal` Closes: #111147 [1] https://clang.llvm.org/docs/LanguageExtensions.html#checked-arithmetic-builtins
`builtin_*_overflow` functions return `_Bool` according to [1]. `BuiltinFunctionChecker` was using `makeTruthVal` w/o specifying explicit type, which creates an `int` value, since it's the type of any compassion according to C standard. Fix it by directly passing `BoolTy` to `makeTruthVal` Closes: llvm#111147 [1] https://clang.llvm.org/docs/LanguageExtensions.html#checked-arithmetic-builtins
Apparently the analyzer mixes signed and unsigned
APSInt
values in a<=
comparison which causes an assertion failure. I found this issue while analyzing a preprocessed version ofunicode.c
from the ruby project, but it was easy to extract a short reproducer: Ericsson@b1e4ddbThis bug is probably introduced by the recent changes to
BoolAssignment
and/or the modeling of__builtin_mul_overflow
, because if I understand correctlysteakhal
was able to analyze the same file with a clang version that was probably a bit older than the fresh main that I'm using now.The text was updated successfully, but these errors were encountered: