[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)
https://github.com/steakhal requested changes to this pull request. https://github.com/llvm/llvm-project/pull/87521 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)
@@ -0,0 +1,16 @@ +// RUN: %clang_analyze_cc1 %s \ steakhal wrote: I think you should put this test without the RUN lines into the `clang/test/Analysis/invalidated-iterator.cpp` to have them at one place. https://github.com/llvm/llvm-project/pull/87521 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)
@@ -57,10 +57,14 @@ ProgramStateRef SimpleConstraintManager::assumeAux(ProgramStateRef State, // We cannot reason about SymSymExprs, and can only reason about some // SymIntExprs. if (!canReasonAbout(Cond)) { -// Just add the constraint to the expression without trying to simplify. SymbolRef Sym = Cond.getAsSymbol(); -assert(Sym); -return assumeSymUnsupported(State, Sym, Assumption); +if (Sym) { + // this will simplify the symbol, so only call this if we have a + // symbol. + return assumeSymUnsupported(State, Sym, Assumption); +} else { + return State; +} steakhal wrote: ```suggestion if (SymbolRef Sym = Cond.getAsSymbol()) return assumeSymUnsupported(State, Sym, Assumption); return State; ``` https://github.com/llvm/llvm-project/pull/87521 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)
@@ -2836,6 +2836,10 @@ bool RangeConstraintManager::canReasonAbout(SVal X) const { return false; } + // Non-integer types are not supported. + if (X.getAs()) +return false; + steakhal wrote: My problem with this is that I think LCVs shouldn't even appear here. And even if they could, why don't we also handle `nonloc::CompoundVals` too? They are basically the same thing, except for the lazyness. So, this patch masks some fundamental problem somewhere else - probably within the iterator checker or container modeling, actually passing an LCV. But I get it, its better to not crash, sure. I'd be happy to merge this and creating a new ticket for investigating what's going on. https://github.com/llvm/llvm-project/pull/87521 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)
@@ -0,0 +1,16 @@ +// RUN: %clang_analyze_cc1 %s \ +// RUN: -analyzer-checker=alpha.cplusplus.InvalidatedIterator \ +// RUN: -analyzer-config aggressive-binary-operation-simplification=true \ +// RUN: 2>&1 + +struct node {}; +struct prop : node {}; +struct bitvec : node { + prop operator==(bitvec) { return prop(); } + bitvec extend(); // { return *this; } steakhal wrote: ```suggestion bitvec extend(); ``` https://github.com/llvm/llvm-project/pull/87521 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/87521 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)
aytey wrote: @steakhal @haoNoQ how's this looking to you? anything further for me to do? https://github.com/llvm/llvm-project/pull/87521 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)
https://github.com/aytey updated https://github.com/llvm/llvm-project/pull/87521 >From 1f70839ea1607f151c9f7eb390fcb974b32a54ca Mon Sep 17 00:00:00 2001 From: "Andrew V. Teylu" Date: Wed, 3 Apr 2024 17:18:08 +0100 Subject: [PATCH 1/3] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` This PR makes two modifications to the {Simple, Range} constraint managers: * `nonloc::LazyCompoundVal` is now explicitly not able to be reasoned about; and * When we have something that cannot be reasoned about, we return an unmodified state (and do not attempt to simplify) For the added test-case, testing under `main` will either hit an `llvm_unreachable` (or go off the rails for other reasons). After this change, the test-case passes successfully. The change stating "Non-integer types are not supported" for `nonloc::LazyCompoundVal` follows the same logic inside of `RangedConstraintManager::assumeSymUnsupported`. However, when a `nonloc::LazyCompoundVal`, we don't want to call `RangedConstraintManager::assumeSymUnsupported` because this will attempt to work with the `Sym` or `State` in a way that isn't compatible with a `nonloc::LazyCompoundVal`. --- .../Core/RangeConstraintManager.cpp | 4 .../Core/SimpleConstraintManager.cpp| 10 +++--- clang/test/Analysis/non_loc_compound.cpp| 17 + 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 clang/test/Analysis/non_loc_compound.cpp diff --git a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp index c6f87b45ab887a..1f3e5711bcc71c 100644 --- a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp +++ b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp @@ -2836,6 +2836,10 @@ bool RangeConstraintManager::canReasonAbout(SVal X) const { return false; } + // Non-integer types are not supported. + if (X.getAs()) +return false; + return true; } diff --git a/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp b/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp index 8ca2cdb9d3ab7a..b84a68ab93ef90 100644 --- a/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp +++ b/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp @@ -57,10 +57,14 @@ ProgramStateRef SimpleConstraintManager::assumeAux(ProgramStateRef State, // We cannot reason about SymSymExprs, and can only reason about some // SymIntExprs. if (!canReasonAbout(Cond)) { -// Just add the constraint to the expression without trying to simplify. SymbolRef Sym = Cond.getAsSymbol(); -assert(Sym); -return assumeSymUnsupported(State, Sym, Assumption); +if (Sym) { + // this will simplify the symbol, so only call this if we have a + // symbol. + return assumeSymUnsupported(State, Sym, Assumption); +} else { + return State; +} } switch (Cond.getKind()) { diff --git a/clang/test/Analysis/non_loc_compound.cpp b/clang/test/Analysis/non_loc_compound.cpp new file mode 100644 index 00..b76ecb8d56635c --- /dev/null +++ b/clang/test/Analysis/non_loc_compound.cpp @@ -0,0 +1,17 @@ +// REQUIRES: crash-recovery, asserts +// RUN: %clang_analyze_cc1 %s \ +// RUN: -analyzer-checker=alpha.cplusplus.InvalidatedIterator \ +// RUN: -analyzer-config aggressive-binary-operation-simplification=true \ +// RUN: 2>&1 + +struct node {}; +struct prop : node {}; +struct bitvec : node { + prop operator==(bitvec) { return prop(); } + bitvec extend(); // { return *this; } +}; +void convert() { + bitvec input; + bitvec output(input.extend()); + output == input; +} >From 9f552209d9ce9bbddca247a46f79b331388908bf Mon Sep 17 00:00:00 2001 From: "Andrew V. Teylu" Date: Wed, 3 Apr 2024 17:18:08 +0100 Subject: [PATCH 2/3] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` This PR makes two modifications to the {Simple, Range} constraint managers: * `nonloc::LazyCompoundVal` is now explicitly not able to be reasoned about; and * When we have something that cannot be reasoned about, we return an unmodified state (and do not attempt to simplify) For the added test-case, testing under `main` will either hit an `llvm_unreachable` (or go off the rails for other reasons). After this change, the test-case passes successfully. The change stating "Non-integer types are not supported" for `nonloc::LazyCompoundVal` follows the same logic inside of `RangedConstraintManager::assumeSymUnsupported`. However, when a `nonloc::LazyCompoundVal`, we don't want to call `RangedConstraintManager::assumeSymUnsupported` because this will attempt to work with the `Sym` or `State` in a way that isn't compatible with a `nonloc::LazyCompoundVal`. --- .../Core/RangeConstraintManager.cpp | 4 .../Core/SimpleConstraintManager.cpp| 10 +++--- clang/test/Analysis/non_loc_compound.cpp| 17 + 3 fi
[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)
https://github.com/aytey updated https://github.com/llvm/llvm-project/pull/87521 >From 1f70839ea1607f151c9f7eb390fcb974b32a54ca Mon Sep 17 00:00:00 2001 From: "Andrew V. Teylu" Date: Wed, 3 Apr 2024 17:18:08 +0100 Subject: [PATCH 1/3] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` This PR makes two modifications to the {Simple, Range} constraint managers: * `nonloc::LazyCompoundVal` is now explicitly not able to be reasoned about; and * When we have something that cannot be reasoned about, we return an unmodified state (and do not attempt to simplify) For the added test-case, testing under `main` will either hit an `llvm_unreachable` (or go off the rails for other reasons). After this change, the test-case passes successfully. The change stating "Non-integer types are not supported" for `nonloc::LazyCompoundVal` follows the same logic inside of `RangedConstraintManager::assumeSymUnsupported`. However, when a `nonloc::LazyCompoundVal`, we don't want to call `RangedConstraintManager::assumeSymUnsupported` because this will attempt to work with the `Sym` or `State` in a way that isn't compatible with a `nonloc::LazyCompoundVal`. --- .../Core/RangeConstraintManager.cpp | 4 .../Core/SimpleConstraintManager.cpp| 10 +++--- clang/test/Analysis/non_loc_compound.cpp| 17 + 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 clang/test/Analysis/non_loc_compound.cpp diff --git a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp index c6f87b45ab887a..1f3e5711bcc71c 100644 --- a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp +++ b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp @@ -2836,6 +2836,10 @@ bool RangeConstraintManager::canReasonAbout(SVal X) const { return false; } + // Non-integer types are not supported. + if (X.getAs()) +return false; + return true; } diff --git a/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp b/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp index 8ca2cdb9d3ab7a..b84a68ab93ef90 100644 --- a/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp +++ b/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp @@ -57,10 +57,14 @@ ProgramStateRef SimpleConstraintManager::assumeAux(ProgramStateRef State, // We cannot reason about SymSymExprs, and can only reason about some // SymIntExprs. if (!canReasonAbout(Cond)) { -// Just add the constraint to the expression without trying to simplify. SymbolRef Sym = Cond.getAsSymbol(); -assert(Sym); -return assumeSymUnsupported(State, Sym, Assumption); +if (Sym) { + // this will simplify the symbol, so only call this if we have a + // symbol. + return assumeSymUnsupported(State, Sym, Assumption); +} else { + return State; +} } switch (Cond.getKind()) { diff --git a/clang/test/Analysis/non_loc_compound.cpp b/clang/test/Analysis/non_loc_compound.cpp new file mode 100644 index 00..b76ecb8d56635c --- /dev/null +++ b/clang/test/Analysis/non_loc_compound.cpp @@ -0,0 +1,17 @@ +// REQUIRES: crash-recovery, asserts +// RUN: %clang_analyze_cc1 %s \ +// RUN: -analyzer-checker=alpha.cplusplus.InvalidatedIterator \ +// RUN: -analyzer-config aggressive-binary-operation-simplification=true \ +// RUN: 2>&1 + +struct node {}; +struct prop : node {}; +struct bitvec : node { + prop operator==(bitvec) { return prop(); } + bitvec extend(); // { return *this; } +}; +void convert() { + bitvec input; + bitvec output(input.extend()); + output == input; +} >From 9f552209d9ce9bbddca247a46f79b331388908bf Mon Sep 17 00:00:00 2001 From: "Andrew V. Teylu" Date: Wed, 3 Apr 2024 17:18:08 +0100 Subject: [PATCH 2/3] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` This PR makes two modifications to the {Simple, Range} constraint managers: * `nonloc::LazyCompoundVal` is now explicitly not able to be reasoned about; and * When we have something that cannot be reasoned about, we return an unmodified state (and do not attempt to simplify) For the added test-case, testing under `main` will either hit an `llvm_unreachable` (or go off the rails for other reasons). After this change, the test-case passes successfully. The change stating "Non-integer types are not supported" for `nonloc::LazyCompoundVal` follows the same logic inside of `RangedConstraintManager::assumeSymUnsupported`. However, when a `nonloc::LazyCompoundVal`, we don't want to call `RangedConstraintManager::assumeSymUnsupported` because this will attempt to work with the `Sym` or `State` in a way that isn't compatible with a `nonloc::LazyCompoundVal`. --- .../Core/RangeConstraintManager.cpp | 4 .../Core/SimpleConstraintManager.cpp| 10 +++--- clang/test/Analysis/non_loc_compound.cpp| 17 + 3 fi
[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)
https://github.com/aytey updated https://github.com/llvm/llvm-project/pull/87521 >From 1f70839ea1607f151c9f7eb390fcb974b32a54ca Mon Sep 17 00:00:00 2001 From: "Andrew V. Teylu" Date: Wed, 3 Apr 2024 17:18:08 +0100 Subject: [PATCH 1/3] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` This PR makes two modifications to the {Simple, Range} constraint managers: * `nonloc::LazyCompoundVal` is now explicitly not able to be reasoned about; and * When we have something that cannot be reasoned about, we return an unmodified state (and do not attempt to simplify) For the added test-case, testing under `main` will either hit an `llvm_unreachable` (or go off the rails for other reasons). After this change, the test-case passes successfully. The change stating "Non-integer types are not supported" for `nonloc::LazyCompoundVal` follows the same logic inside of `RangedConstraintManager::assumeSymUnsupported`. However, when a `nonloc::LazyCompoundVal`, we don't want to call `RangedConstraintManager::assumeSymUnsupported` because this will attempt to work with the `Sym` or `State` in a way that isn't compatible with a `nonloc::LazyCompoundVal`. --- .../Core/RangeConstraintManager.cpp | 4 .../Core/SimpleConstraintManager.cpp| 10 +++--- clang/test/Analysis/non_loc_compound.cpp| 17 + 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 clang/test/Analysis/non_loc_compound.cpp diff --git a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp index c6f87b45ab887a..1f3e5711bcc71c 100644 --- a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp +++ b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp @@ -2836,6 +2836,10 @@ bool RangeConstraintManager::canReasonAbout(SVal X) const { return false; } + // Non-integer types are not supported. + if (X.getAs()) +return false; + return true; } diff --git a/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp b/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp index 8ca2cdb9d3ab7a..b84a68ab93ef90 100644 --- a/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp +++ b/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp @@ -57,10 +57,14 @@ ProgramStateRef SimpleConstraintManager::assumeAux(ProgramStateRef State, // We cannot reason about SymSymExprs, and can only reason about some // SymIntExprs. if (!canReasonAbout(Cond)) { -// Just add the constraint to the expression without trying to simplify. SymbolRef Sym = Cond.getAsSymbol(); -assert(Sym); -return assumeSymUnsupported(State, Sym, Assumption); +if (Sym) { + // this will simplify the symbol, so only call this if we have a + // symbol. + return assumeSymUnsupported(State, Sym, Assumption); +} else { + return State; +} } switch (Cond.getKind()) { diff --git a/clang/test/Analysis/non_loc_compound.cpp b/clang/test/Analysis/non_loc_compound.cpp new file mode 100644 index 00..b76ecb8d56635c --- /dev/null +++ b/clang/test/Analysis/non_loc_compound.cpp @@ -0,0 +1,17 @@ +// REQUIRES: crash-recovery, asserts +// RUN: %clang_analyze_cc1 %s \ +// RUN: -analyzer-checker=alpha.cplusplus.InvalidatedIterator \ +// RUN: -analyzer-config aggressive-binary-operation-simplification=true \ +// RUN: 2>&1 + +struct node {}; +struct prop : node {}; +struct bitvec : node { + prop operator==(bitvec) { return prop(); } + bitvec extend(); // { return *this; } +}; +void convert() { + bitvec input; + bitvec output(input.extend()); + output == input; +} >From 9f552209d9ce9bbddca247a46f79b331388908bf Mon Sep 17 00:00:00 2001 From: "Andrew V. Teylu" Date: Wed, 3 Apr 2024 17:18:08 +0100 Subject: [PATCH 2/3] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` This PR makes two modifications to the {Simple, Range} constraint managers: * `nonloc::LazyCompoundVal` is now explicitly not able to be reasoned about; and * When we have something that cannot be reasoned about, we return an unmodified state (and do not attempt to simplify) For the added test-case, testing under `main` will either hit an `llvm_unreachable` (or go off the rails for other reasons). After this change, the test-case passes successfully. The change stating "Non-integer types are not supported" for `nonloc::LazyCompoundVal` follows the same logic inside of `RangedConstraintManager::assumeSymUnsupported`. However, when a `nonloc::LazyCompoundVal`, we don't want to call `RangedConstraintManager::assumeSymUnsupported` because this will attempt to work with the `Sym` or `State` in a way that isn't compatible with a `nonloc::LazyCompoundVal`. --- .../Core/RangeConstraintManager.cpp | 4 .../Core/SimpleConstraintManager.cpp| 10 +++--- clang/test/Analysis/non_loc_compound.cpp| 17 + 3 fi
[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)
aytey wrote: > I suspect that you're loading checkers as clang plugins and one of them is > causing it. So here's how I'm invoking `clang` for those crashes: * `./bin/clang -cc1 -analyze -analyzer-checker=nullability.NullPassedToNonnull -analyzer-config aggressive-binary-operation-simplification=true ` For those crashes `` can be anything (even empty!) and you get the same backtrace. > There's something else going on. Yeah, I'd agree with that! 😄 https://github.com/llvm/llvm-project/pull/87521 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)
https://github.com/aytey updated https://github.com/llvm/llvm-project/pull/87521 >From 1f70839ea1607f151c9f7eb390fcb974b32a54ca Mon Sep 17 00:00:00 2001 From: "Andrew V. Teylu" Date: Wed, 3 Apr 2024 17:18:08 +0100 Subject: [PATCH] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` This PR makes two modifications to the {Simple, Range} constraint managers: * `nonloc::LazyCompoundVal` is now explicitly not able to be reasoned about; and * When we have something that cannot be reasoned about, we return an unmodified state (and do not attempt to simplify) For the added test-case, testing under `main` will either hit an `llvm_unreachable` (or go off the rails for other reasons). After this change, the test-case passes successfully. The change stating "Non-integer types are not supported" for `nonloc::LazyCompoundVal` follows the same logic inside of `RangedConstraintManager::assumeSymUnsupported`. However, when a `nonloc::LazyCompoundVal`, we don't want to call `RangedConstraintManager::assumeSymUnsupported` because this will attempt to work with the `Sym` or `State` in a way that isn't compatible with a `nonloc::LazyCompoundVal`. --- .../Core/RangeConstraintManager.cpp | 4 .../Core/SimpleConstraintManager.cpp| 10 +++--- clang/test/Analysis/non_loc_compound.cpp| 17 + 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 clang/test/Analysis/non_loc_compound.cpp diff --git a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp index c6f87b45ab887a..1f3e5711bcc71c 100644 --- a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp +++ b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp @@ -2836,6 +2836,10 @@ bool RangeConstraintManager::canReasonAbout(SVal X) const { return false; } + // Non-integer types are not supported. + if (X.getAs()) +return false; + return true; } diff --git a/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp b/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp index 8ca2cdb9d3ab7a..b84a68ab93ef90 100644 --- a/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp +++ b/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp @@ -57,10 +57,14 @@ ProgramStateRef SimpleConstraintManager::assumeAux(ProgramStateRef State, // We cannot reason about SymSymExprs, and can only reason about some // SymIntExprs. if (!canReasonAbout(Cond)) { -// Just add the constraint to the expression without trying to simplify. SymbolRef Sym = Cond.getAsSymbol(); -assert(Sym); -return assumeSymUnsupported(State, Sym, Assumption); +if (Sym) { + // this will simplify the symbol, so only call this if we have a + // symbol. + return assumeSymUnsupported(State, Sym, Assumption); +} else { + return State; +} } switch (Cond.getKind()) { diff --git a/clang/test/Analysis/non_loc_compound.cpp b/clang/test/Analysis/non_loc_compound.cpp new file mode 100644 index 00..b76ecb8d56635c --- /dev/null +++ b/clang/test/Analysis/non_loc_compound.cpp @@ -0,0 +1,17 @@ +// REQUIRES: crash-recovery, asserts +// RUN: %clang_analyze_cc1 %s \ +// RUN: -analyzer-checker=alpha.cplusplus.InvalidatedIterator \ +// RUN: -analyzer-config aggressive-binary-operation-simplification=true \ +// RUN: 2>&1 + +struct node {}; +struct prop : node {}; +struct bitvec : node { + prop operator==(bitvec) { return prop(); } + bitvec extend(); // { return *this; } +}; +void convert() { + bitvec input; + bitvec output(input.extend()); + output == input; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)
@@ -0,0 +1,17 @@ +// REQUIRES: crash-recovery, asserts aytey wrote: Actually, that's a good point. I added that bit because the only way I can *guarantee* it will crash (with main) is if we have asserts on. I'll remove this, but if someone wants to check the test I added and they go "hey, this works on main!", then hopefully they'll try an assertion-enabled build 🙏 https://github.com/llvm/llvm-project/pull/87521 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)
haoNoQ wrote: > Here's the traceback for the second set: The constraint manager doesn't even exist yet at the moment of time represented by this backtrace. There's something else going on. I suspect that you're loading checkers as clang plugins and one of them is causing it. https://github.com/llvm/llvm-project/pull/87521 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer] `canReasonAbout` does not support `nonloc::LazyCompoundVal` (PR #87521)
@@ -0,0 +1,17 @@ +// REQUIRES: crash-recovery, asserts haoNoQ wrote: You probably don't need this. There's no need to disable a perfectly normal test just because it didn't crash before the patch in that configuration. It's still nice to know that it doesn't crash after the patch _regardless of_ configuration. https://github.com/llvm/llvm-project/pull/87521 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits