Conversation
… boolean expression to integer * Fixing llvm#108900 for incorrect "REQUIRES" condition for Z3 * Fixing llvm#168034 for the test failure * Adding more comments about the fixes in llvm#168034 for the tests introduced in llvm#158276
|
@llvm/pr-subscribers-clang-static-analyzer-1 @llvm/pr-subscribers-clang Author: Ella Ma (Snape3058) Changes
Full diff: https://github.com/llvm/llvm-project/pull/183034.diff 1 Files Affected:
diff --git a/clang/test/Analysis/z3-unarysymexpr.c b/clang/test/Analysis/z3-unarysymexpr.c
index 82b0fc988a383..efe558c3146e8 100644
--- a/clang/test/Analysis/z3-unarysymexpr.c
+++ b/clang/test/Analysis/z3-unarysymexpr.c
@@ -1,10 +1,10 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s \
-// RUN: -analyzer-constraints=z3
+// RUN: -analyzer-constraints=z3
// RUN: %clang_analyze_cc1 -verify %s \
// RUN: -analyzer-checker=core,debug.ExprInspection \
// RUN: -analyzer-config crosscheck-with-z3=true
-// REQUIRES: Z3
+// REQUIRES: z3
//
// Previously Z3 analysis crashed when it encountered an UnarySymExpr, validate
// that this no longer happens.
@@ -25,6 +25,10 @@ int negate(int x, int y) {
// then causes Z3 to crash. The accompanying patch just strips the negative
// operator before submitting to Z3 to avoid the crash.
//
+// In PR 168034, we fixed this problem by converting boolean expressions to
+// bitvec with Z3's ite operator "(ite THE_BOOL_EXPR #x00000000 #x00000001)"
+// and actually conducting the negation on the result.
+//
// TODO: Find the root cause of this and fix it in symbol manager
//
void c();
@@ -49,9 +53,10 @@ int z3_crash2(int a) {
}
// Refer to issue 165779
-void z3_crash3(long a) {
+long z3_crash3(long a) {
if (~-(5 && a)) {
long *c;
- *c; // expected-warning{{Dereference of undefined pointer value (loaded from variable 'c')}}
+ return *c; // expected-warning{{Dereference of undefined pointer value (loaded from variable 'c')}}
}
+ return 0;
}
|
|
Thank you for the review. Please help me merge it if @vabridgers is not against it. |
There was a problem hiding this comment.
The change LGTM, but at first I was very confused by the PR description, more precisely the phrasing "Fixing <PR LINK> for <PROBLEM DESCRIPTION>" in the first two bullet points. I'm not a native English speaker, so this may be a valid expression that I'm not familiar with, but I would suggest rephrasing these sentences as "Fixing <PROBLEM DESCRIPTION> introduced in <PR LINK>".
Could you edit the PR description and title as you see fit? @NagyDonat |
|
I edited the PR description. I'm only 98% sure that this was the intended meaning of the original description, so @Snape3058 please check it and fix it if I misunderstood it. |
|
LGTM |
…is/z3/` subdirectory Addressing llvm#181581, continuing llvm#183034 This enables executing all test cases with the `REQUIRES: z3` tag via the `check-clang-analysis-z3` target.
|
Mentioning the original issue #181581 here to make them linked. Sorry for the spam. |
…is/z3/` subdirectory (llvm#183724) Addressing llvm#181581, continuing llvm#183034 This enables executing all test cases with the `REQUIRES: z3` tag via the `check-clang-analysis-z3` target.
…is/z3/` subdirectory (llvm#183724) Addressing llvm#181581, continuing llvm#183034 This enables executing all test cases with the `REQUIRES: z3` tag via the `check-clang-analysis-z3` target.
…is/z3/` subdirectory (llvm#183724) Addressing llvm#181581, continuing llvm#183034 This enables executing all test cases with the `REQUIRES: z3` tag via the `check-clang-analysis-z3` target.
Uh oh!
There was an error while loading. Please reload this page.