[PATCH] D142627: [analyzer] Fix crash exposed by D140059
Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 26 10:56:11 PST 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf027dd55f32a: [analyzer] Fix crash exposed by D140059 (authored by einvbri <vince.a.bridgers at ericsson.com>).
Changed prior to commit:
https://reviews.llvm.org/D142627?vs=492432&id=492521#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142627/new/
https://reviews.llvm.org/D142627
Files:
clang/test/Analysis/z3-crosscheck.c
llvm/lib/Support/Z3Solver.cpp
Index: llvm/lib/Support/Z3Solver.cpp
===================================================================
--- llvm/lib/Support/Z3Solver.cpp
+++ llvm/lib/Support/Z3Solver.cpp
@@ -729,7 +729,7 @@
const Z3_sort Z3Sort = toZ3Sort(*getBitvectorSort(BitWidth)).Sort;
// Slow path, when 64 bits are not enough.
- if (LLVM_UNLIKELY(Int.getBitWidth() > 64u)) {
+ if (LLVM_UNLIKELY(!Int.isRepresentableByInt64())) {
SmallString<40> Buffer;
Int.toString(Buffer, 10);
return newExprRef(Z3Expr(
Index: clang/test/Analysis/z3-crosscheck.c
===================================================================
--- clang/test/Analysis/z3-crosscheck.c
+++ clang/test/Analysis/z3-crosscheck.c
@@ -77,3 +77,15 @@
// expected-warning at -1{{garbage}}
}
}
+
+// don't crash, and also produce a core.CallAndMessage finding
+void a(int);
+typedef struct {
+ int b;
+} c;
+c *d;
+void e() {
+ (void)d->b;
+ int f;
+ a(f); // expected-warning {{1st function call argument is an uninitialized value [core.CallAndMessage]}}
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142627.492521.patch
Type: text/x-patch
Size: 1046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230126/5e9e2923/attachment.bin>
More information about the llvm-commits
mailing list