diff options
author | einvbri <vince.a.bridgers@ericsson.com> | 2023-01-26 08:23:22 -0600 |
---|---|---|
committer | einvbri <vince.a.bridgers@ericsson.com> | 2023-01-26 12:55:42 -0600 |
commit | f027dd55f32a3c1803fc3cbd53029acee849465c (patch) | |
tree | 1dc379f92c66d74e02af51455ad0e9bfa865fa5b /llvm/unittests/Support/MathExtrasTest.cpp | |
parent | 7dbeb127eaf6639aa7d0839ade964cf6f1528597 (diff) | |
download | llvm-f027dd55f32a3c1803fc3cbd53029acee849465c.zip llvm-f027dd55f32a3c1803fc3cbd53029acee849465c.tar.gz llvm-f027dd55f32a3c1803fc3cbd53029acee849465c.tar.bz2 |
[analyzer] Fix crash exposed by D140059
Change https://reviews.llvm.org/D140059 exposed the following crash in
Z3Solver, where bit widths were not checked consistently with that
change. This change makes the check consistent, and fixes the crash.
```
clang: <root>/llvm/include/llvm/ADT/APSInt.h:99:
int64_t llvm::APSInt::getExtValue() const: Assertion
`isRepresentableByInt64() && "Too many bits for int64_t"' failed.
...
Stack dump:
0. Program arguments: clang -cc1 -internal-isystem <root>/lib/clang/16/include
-nostdsysteminc -analyze -analyzer-checker=core,unix.Malloc,debug.ExprInspection
-analyzer-config crosscheck-with-z3=true -verify reproducer.c
#0 0x00000000045b3476 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
<root>/llvm/lib/Support/Unix/Signals.inc:567:22
#1 0x00000000045b3862 PrintStackTraceSignalHandler(void*)
<root>/llvm/lib/Support/Unix/Signals.inc:641:1
#2 0x00000000045b14a5 llvm::sys::RunSignalHandlers()
<root>/llvm/lib/Support/Signals.cpp:104:20
#3 0x00000000045b2eb4 SignalHandler(int)
<root>/llvm/lib/Support/Unix/Signals.inc:412:1
...
#9 0x0000000004be2eb3 llvm::APSInt::getExtValue() const
<root>/llvm/include/llvm/ADT/APSInt.h:99:5
<root>/llvm/lib/Support/Z3Solver.cpp:740:53
clang::ASTContext&, clang::ento::SymExpr const*, llvm::APSInt const&, llvm::APSInt const&, bool)
<root>/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h:552:61
```
Reviewed By: steakhal
Differential Revision: https://reviews.llvm.org/D142627
Diffstat (limited to 'llvm/unittests/Support/MathExtrasTest.cpp')
0 files changed, 0 insertions, 0 deletions