[clang] [clang] fix wrong result of pointers comparison between unknown and stack (PR #122404)

2025-01-11 Thread Balazs Benics via cfe-commits
steakhal wrote: My current stance is that we should have the memoryspace trait only for memregions that have an UnknownSpace memspace, becuase that would be the least amount of work. So it would be a hybrid solution. We have the memspaces as we have today, but for UnknownSpace you would need to

[clang] [analyzer] Widen loops: Augment assignment note when values invalidated at the start of a loop (PR #122398)

2025-01-11 Thread Balazs Benics via cfe-commits
steakhal wrote: > I agree that it would make more sense to generalize this beyond loop > widening. However, I'm having a hard time understanding how your proposal > would fit in to the augmentation of the assignment message like I do in this > PR. > > The part I'm most confused about is how w

[clang] [analyzer] Widen loops: Augment assignment note when values invalidated at the start of a loop (PR #122398)

2025-01-10 Thread Balazs Benics via cfe-commits
steakhal wrote: I agree that it's important to augment the bug reports with information about the source of the symbols. Especially for conjured and derived symbols that are produced widely because of invalidations. Loop widening is just one source of invalidation, and we could generalize it s

[clang] [clang] fix wrong result of pointers comparison between unknown and stack (PR #122404)

2025-01-10 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,48 @@ +// RUN: %clang_analyze_cc1 -triple=x86_64-pc-linux-gnu -analyzer-checker=core,unix.Stream,debug.ExprInspection \ +// RUN: -analyzer-config eagerly-assume=false,unix.Stream:Pedantic=true -verify %s +// RUN: %clang_analyze_cc1 -triple=armv8-none-linux-eabi -an

[clang] [clang] fix wrong result of pointers comparison between unknown and stack (PR #122404)

2025-01-10 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/122404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] fix wrong result of pointers comparison between unknown and stack (PR #122404)

2025-01-10 Thread Balazs Benics via cfe-commits
@@ -952,6 +952,12 @@ SVal SimpleSValBuilder::evalBinOpLL(ProgramStateRef state, const MemSpaceRegion *RightMS = RightBase->getMemorySpace(); const MemSpaceRegion *UnknownMS = MemMgr.getUnknownRegion(); +if (LeftMS != RightMS && +((isa(LeftMS) && isa(RightMS

[clang] [clang] fix wrong result of pointers comparison between unknown and stack (PR #122404)

2025-01-10 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,48 @@ +// RUN: %clang_analyze_cc1 -triple=x86_64-pc-linux-gnu -analyzer-checker=core,unix.Stream,debug.ExprInspection \ +// RUN: -analyzer-config eagerly-assume=false,unix.Stream:Pedantic=true -verify %s +// RUN: %clang_analyze_cc1 -triple=armv8-none-linux-eabi -an

[clang] [clang] fix wrong result of pointers comparison between unknown and stack (PR #122404)

2025-01-10 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,48 @@ +// RUN: %clang_analyze_cc1 -triple=x86_64-pc-linux-gnu -analyzer-checker=core,unix.Stream,debug.ExprInspection \ +// RUN: -analyzer-config eagerly-assume=false,unix.Stream:Pedantic=true -verify %s +// RUN: %clang_analyze_cc1 -triple=armv8-none-linux-eabi -an

[clang] [clang] fix wrong result of pointers comparison between unknown and stack (PR #122404)

2025-01-10 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. In general, the concept of having the memory space directly embedded into a memory region is flawed. And that is the root cause of the problem. Ideally, the property of "in what memory space does this region live in" is a trai

[clang] [clang][analyzer] Split NullDereferenceChecker into a modeling and reporting (PR #122139)

2025-01-09 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/122139 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][analyzer][docs] Remove some orphaned images (PR #122249)

2025-01-09 Thread Balazs Benics via cfe-commits
steakhal wrote: Now that I looked at that PR, it was merged without approval, while having open comments. https://github.com/llvm/llvm-project/pull/122249 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] [analyzer][NFC] Update stale test after #97265 (PR #122272)

2025-01-09 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/122272 In my patch there, I left a test expectation stale. Tests with `REQUIRES: Z3` never run because no bots check such configurations. Here I'm adjusting the test expectations to meet reality. >From 70d29e2ed8a98

[clang] [NFC][analyzer][docs] Remove some orphaned images (PR #122249)

2025-01-09 Thread Balazs Benics via cfe-commits
steakhal wrote: Its usually good practice to refer to the last commit where the dead resources become dead. You can use the git log -S to find out about the commits the thing is mentioned. Example: `git log -Sexample_custom_assert -- clang/www/analyzer/`, will mention: ``` 61a76f58ebf161c739fb1

[clang] [clang][analyzer] Split NullDereferenceChecker into a modeling and checker part (PR #122139)

2025-01-08 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -351,12 +356,30 @@ void DereferenceChecker::checkBind(SVal L, SVal V, const Stmt *S, C.addTransition(State, this); } -void ento::registerDereferenceChecker(CheckerManager &mgr) { - auto *Chk = mgr.registerChecker(); -

[clang] [clang][analyzer] Split NullDereferenceChecker into a modeling and checker part (PR #122139)

2025-01-08 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -351,12 +356,30 @@ void DereferenceChecker::checkBind(SVal L, SVal V, const Stmt *S, C.addTransition(State, this); } -void ento::registerDereferenceChecker(CheckerManager &mgr) { - auto *Chk = mgr.registerChecker(); -

[clang] [clang][analyzer] Split NullDereferenceChecker into a modeling and checker part (PR #122139)

2025-01-08 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/122139 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Split NullDereferenceChecker into a modeling and checker part (PR #122139)

2025-01-08 Thread Balazs Benics via cfe-commits
=?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= Message-ID: In-Reply-To: @@ -155,22 +155,27 @@ static bool isDeclRefExprToReference(const Expr *E) { void DereferenceChecker::reportBug(DerefKind K, ProgramStateRef State, const Stmt *S, CheckerContext &C)

[clang] [clang][analyzer] Split NullDereferenceChecker into a modeling and checker part (PR #122139)

2025-01-08 Thread Balazs Benics via cfe-commits
=?utf-8?q?Bal=C3=A1zs_K=C3=A9ri?= Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. LGTM. https://github.com/llvm/llvm-project/pull/122139 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang] [NFC][analyzer][docs] Crosslink MallocChecker's ownership attributes (PR #121939)

2025-01-07 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM. Please check if the generated docs look as intended before merging. https://github.com/llvm/llvm-project/pull/121939 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llv

[clang] [analyzer][NFC] Simplify PositiveAnalyzerOption handling (PR #121910)

2025-01-07 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/121910 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Simplify PositiveAnalyzerOption handling (PR #121910)

2025-01-07 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/121910 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Simplify PositiveAnalyzerOption handling (PR #121910)

2025-01-07 Thread Balazs Benics via cfe-commits
steakhal wrote: FYI @necto https://github.com/llvm/llvm-project/pull/121910 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Simplify PositiveAnalyzerOption handling (PR #121910)

2025-01-07 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/121910 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Simplify PositiveAnalyzerOption handling (PR #121910)

2025-01-07 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/121910 This simplifies #120239 Addresses my comment at: https://github.com/llvm/llvm-project/pull/120239#issuecomment-2574600543 >From 49bac3d08faee3fe962326b69ac4cb49a07643af Mon Sep 17 00:00:00 2001 From: Balazs Ben

[clang] [analyzer] Retry UNDEF Z3 queries 2 times by default (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
steakhal wrote: I find this really unfortunate that I had to patch the other places where we initialize the AnalyzerOptions table. Just because the we can't assign the default value to the given option. This makes me reconsider my approach because it WILL break all downstream users. Any suggest

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
=?utf-8?q?Kristóf?= Umann , =?utf-8?q?Kristóf?= Umann , =?utf-8?q?Kristóf?= Umann Message-ID: In-Reply-To: steakhal wrote: Could you please check the generated html prior merging this, just to be on the safe side it looks as intended. https://github.com/llvm/llvm-project/pull/121759

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
=?utf-8?q?Kristóf?= Umann , =?utf-8?q?Kristóf?= Umann , =?utf-8?q?Kristóf?= Umann Message-ID: In-Reply-To: @@ -1407,8 +1407,17 @@ These attributes are used by the Clang Static Analyzer's dynamic memory modeling facilities to mark custom allocating/deallocating functions. A

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
=?utf-8?q?Krist=C3=B3f?= Umann , =?utf-8?q?Krist=C3=B3f?= Umann , =?utf-8?q?Krist=C3=B3f?= Umann Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. Looks truly awesome https://github.com/llvm/llvm-project/pull/121759 __

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
=?utf-8?q?Kristóf?= Umann , =?utf-8?q?Kristóf?= Umann , =?utf-8?q?Kristóf?= Umann Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/121759 ___ cfe-commits mailing list cfe-commits@lists.llvm.org htt

[clang] [analyzer] Retry UNDEF Z3 queries 2 times by default (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/120239 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
=?utf-8?q?Kristóf?= Umann Message-ID: In-Reply-To: @@ -1389,6 +1389,68 @@ Query for this attribute with ``__has_attribute(overloadable)``. }]; } +def OwnershipDocs : Documentation { + let Heading = "ownership_holds, ownership_returns, ownership_takes (Clang " +

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
=?utf-8?q?Kristóf?= Umann Message-ID: In-Reply-To: steakhal wrote: You have a build error: https://github.com/llvm/llvm-project/actions/runs/12634515572/job/35202412861#step:10:773 https://github.com/llvm/llvm-project/pull/121759 ___ cfe-commits mai

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
=?utf-8?q?Kristóf?= Umann Message-ID: In-Reply-To: @@ -1389,6 +1389,68 @@ Query for this attribute with ``__has_attribute(overloadable)``. }]; } +def OwnershipDocs : Documentation { + let Heading = "ownership_holds, ownership_returns, ownership_takes (Clang " +

[clang] [analyzer] Retry UNDEF Z3 queries 2 times by default (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/120239 >From f7041f5f6f0127f335bedf081f648e769007a827 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Tue, 17 Dec 2024 15:35:27 +0100 Subject: [PATCH 1/7] [analyzer] Retry UNDEF Z3 queries at most "crosscheck-with

[clang] [analyzer] Retry UNDEF Z3 queries 2 times by default (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/120239 >From f7041f5f6f0127f335bedf081f648e769007a827 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Tue, 17 Dec 2024 15:35:27 +0100 Subject: [PATCH 1/6] [analyzer] Retry UNDEF Z3 queries at most "crosscheck-with

[clang] [analyzer] Retry UNDEF Z3 queries at most "crosscheck-with-z3-retries-on-timeout" times (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
@@ -77,16 +80,32 @@ void Z3CrosscheckVisitor::finalizeVisitor(BugReporterContext &BRC, RefutationSolver->addConstraint(SMTConstraints); } - // And check for satisfiability - llvm::TimeRecord Start = llvm::TimeRecord::getCurrentTime(/*Start=*/true); - std::optional Is

[clang] [analyzer] Retry UNDEF Z3 queries 2 times by default (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
steakhal wrote: > LGTM, thanks for the updates! > > If the updated test passes, feel free to merge it. The uploaded tests never run in the CI due to the `REQUIRES: Z3`. I double checked locally and everything passes. Thanks for the review. https://github.com/llvm/llvm-project/pull/120239 ___

[clang] [analyzer] Retry UNDEF Z3 queries 2 times by default (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
@@ -213,6 +215,15 @@ ANALYZER_OPTION( "400'000 should on average make Z3 queries run for up to 100ms on modern " "hardware. Set 0 for unlimited.", 0) +ANALYZER_OPTION( +unsigned, Z3CrosscheckRetriesOnTimeout, +"crosscheck-with-z3-retries-on-timeout", +"Set

[clang] [analyzer] Retry UNDEF Z3 queries 2 times by default (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/120239 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Retry UNDEF Z3 queries at most "crosscheck-with-z3-retries-on-timeout" times (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/120239 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Retry UNDEF Z3 queries at most "crosscheck-with-z3-retries-on-timeout" times (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/120239 >From f7041f5f6f0127f335bedf081f648e769007a827 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Tue, 17 Dec 2024 15:35:27 +0100 Subject: [PATCH 1/5] [analyzer] Retry UNDEF Z3 queries at most "crosscheck-with

[clang] [analyzer] Retry UNDEF Z3 queries at most "crosscheck-with-z3-retries-on-timeout" times (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/120239 >From f7041f5f6f0127f335bedf081f648e769007a827 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Tue, 17 Dec 2024 15:35:27 +0100 Subject: [PATCH 1/3] [analyzer] Retry UNDEF Z3 queries at most "crosscheck-with

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
@@ -1389,6 +1389,68 @@ Query for this attribute with ``__has_attribute(overloadable)``. }]; } +def OwnershipDocs : Documentation { + let Heading = "ownership_holds, ownership_returns, ownership_takes (Clang " +"Static Analyzer)"; + let Category = DocCatFun

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. Looks pretty good. Thanks for the docs. That's always a nice way to start a year. https://github.com/llvm/llvm-project/pull/121759 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
@@ -1389,6 +1389,68 @@ Query for this attribute with ``__has_attribute(overloadable)``. }]; } +def OwnershipDocs : Documentation { + let Heading = "ownership_holds, ownership_returns, ownership_takes (Clang " +"Static Analyzer)"; + let Category = DocCatFun

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
@@ -1389,6 +1389,68 @@ Query for this attribute with ``__has_attribute(overloadable)``. }]; } +def OwnershipDocs : Documentation { + let Heading = "ownership_holds, ownership_returns, ownership_takes (Clang " +"Static Analyzer)"; + let Category = DocCatFun

[clang] [NFC][analyzer][docs] Document MallocChecker's ownership attributes (PR #121759)

2025-01-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/121759 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reapply "[clang][analyzer] Stable order for SymbolRef-keyed containers" (PR #121749)

2025-01-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/121749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reapply "[clang][analyzer] Stable order for SymbolRef-keyed containers" (PR #121749)

2025-01-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. Once the premerge bots are happy, we can merge this. Thanks! https://github.com/llvm/llvm-project/pull/121749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[clang] Reapply "[clang][analyzer] Stable order for SymbolRef-keyed containers" (PR #121749)

2025-01-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/121749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reapply "[clang][analyzer] Stable order for SymbolRef-keyed containers" (PR #121749)

2025-01-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/121749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Retry UNDEF Z3 queries at most "crosscheck-with-z3-retries-on-timeout" times (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
steakhal wrote: > I'm a bit surprised by the idea of using multiple attempts instead of a > single run with a larger timeout -- intuitively we're wasting the already > performed calculations if we are impatient and abort+restart the calculations > after each short timeout (instead of allocatin

[clang] [analyzer] Retry UNDEF Z3 queries at most "crosscheck-with-z3-retries-on-timeout" times (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
@@ -213,6 +215,15 @@ ANALYZER_OPTION( "400'000 should on average make Z3 queries run for up to 100ms on modern " "hardware. Set 0 for unlimited.", 0) +ANALYZER_OPTION( +unsigned, Z3CrosscheckRetriesOnTimeout, +"crosscheck-with-z3-retries-on-timeout", +"Set

[clang] [analyzer] Retry UNDEF Z3 queries at most "crosscheck-with-z3-retries-on-timeout" times (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
@@ -77,16 +80,33 @@ void Z3CrosscheckVisitor::finalizeVisitor(BugReporterContext &BRC, RefutationSolver->addConstraint(SMTConstraints); } - // And check for satisfiability - llvm::TimeRecord Start = llvm::TimeRecord::getCurrentTime(/*Start=*/true); - std::optional Is

[clang] [analyzer] Retry UNDEF Z3 queries at most "crosscheck-with-z3-retries-on-timeout" times (PR #120239)

2025-01-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/120239 >From f7041f5f6f0127f335bedf081f648e769007a827 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Tue, 17 Dec 2024 15:35:27 +0100 Subject: [PATCH 1/2] [analyzer] Retry UNDEF Z3 queries at most "crosscheck-with

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Balazs Benics via cfe-commits
steakhal wrote: @necto Please have a look at the build failures. There are plenty. For the time being, I reverted this PR. https://github.com/llvm/llvm-project/pull/121551 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[clang] Revert "[clang][analyzer] Stable order for SymbolRef-keyed containers" (PR #121592)

2025-01-03 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/121592 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "[clang][analyzer] Stable order for SymbolRef-keyed containers" (PR #121592)

2025-01-03 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/121592 Reverts llvm/llvm-project#121551 We had a bunch of build errors caused by this PR. https://lab.llvm.org/buildbot/#/builders/144/builds/14875 >From 81d2afb2991e636de374eb1d1b550786618ed036 Mon Sep 17 00:00:00

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/121551 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM, thanks. https://github.com/llvm/llvm-project/pull/121551 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Balazs Benics via cfe-commits
@@ -687,4 +711,35 @@ class SymbolVisitor { } // namespace clang +// Override the default definition that would use pointer values of SymbolRefs +// to order them, which is unstable due to ASLR. +// Use the SymbolID instead which reflect the order in which the symbols were +//

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Balazs Benics via cfe-commits
@@ -687,4 +711,35 @@ class SymbolVisitor { } // namespace clang +// Override the default definition that would use pointer values of SymbolRefs +// to order them, which is unstable due to ASLR. +// Use the SymbolID instead which reflect the order in which the symbols were +//

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Balazs Benics via cfe-commits
@@ -687,4 +711,35 @@ class SymbolVisitor { } // namespace clang +// Override the default definition that would use pointer values of SymbolRefs +// to order them, which is unstable due to ASLR. +// Use the SymbolID instead which reflect the order in which the symbols were +//

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Balazs Benics via cfe-commits
@@ -56,6 +68,8 @@ class SymExpr : public llvm::FoldingSetNode { Kind getKind() const { return K; } + SymbolID getSymbolID() const { return Sym; } steakhal wrote: This is expected to be a fairly infrequently used API. I think this deserves to be highlight

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/121551 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Stable order for SymbolRef-keyed containers (PR #121551)

2025-01-03 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: @Xazax-hun I'm pretty happy with this PR, but I'm curious about your opinion on adding the `SymbolID Sym` member to the SymExprs. https://github.com/llvm/llvm-project/pull/121551 ___ cfe-commits mailing list cfe-

[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2025-01-02 Thread Balazs Benics via cfe-commits
=?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy Message-ID: In-Reply-To: https://github.com/steakhal appr

[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2025-01-02 Thread Balazs Benics via cfe-commits
=?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy Message-ID: In-Reply-To: steakhal wrote: One more thing. Please mention this in the release notes. https://github.c

[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2025-01-02 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. > If I understand correctly, I handled every review suggestion. >

[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2025-01-02 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/119388 _

[clang] [analyzer] Don't assume third iteration in loops (PR #119388)

2025-01-02 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: @@ -910,38 +910,51 @@ void pr6302(id x, Class y) { //===-

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2025-01-02 Thread Balazs Benics via cfe-commits
@@ -427,8 +434,8 @@ class BinarySymExprImpl : public BinarySymExpr { public: BinarySymExprImpl(LHSTYPE lhs, BinaryOperator::Opcode op, RHSTYPE rhs, -QualType t) - : BinarySymExpr(ClassKind, op, t), LHS(lhs), RHS(rhs) { +QualType t

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2024-12-31 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/121347 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2024-12-31 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: The content look narrow and precise. It raises me questions why is the only user of this new field the Constraint manager? And if the constraint manager is the only user, why is the SMT-based solver not using this? Should all the other immutableSet/Map ben

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2024-12-31 Thread Balazs Benics via cfe-commits
@@ -401,7 +401,22 @@ class RangeSet { friend class Factory; }; -using ConstraintMap = llvm::ImmutableMap; +struct ConstraintKVInfo : llvm::ImutKeyValueInfo { + static inline bool isEqual(key_type_ref L, key_type_ref R) { +return L->getAllocID() == R->getAllocID(); + }

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2024-12-31 Thread Balazs Benics via cfe-commits
@@ -427,8 +434,8 @@ class BinarySymExprImpl : public BinarySymExpr { public: BinarySymExprImpl(LHSTYPE lhs, BinaryOperator::Opcode op, RHSTYPE rhs, -QualType t) - : BinarySymExpr(ClassKind, op, t), LHS(lhs), RHS(rhs) { +QualType t

[clang] [clang][analyzer] Stabilize path-constraint order by using alloc IDs (PR #121347)

2024-12-30 Thread Balazs Benics via cfe-commits
steakhal wrote: Disclaimer: I haven't checked the actual patch, but I'll come back to it :D Maybe next year. I think I've seen already a variant of this downstream and I generally agreed with the vision. I don't expect much friction on this front, but I'll have a deeper look. --- > This patc

[clang] [analyzer] Fix zext assertion failure in loop unrolling (PR #121203)

2024-12-28 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/121203 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Fix zext assertion failure in loop unrolling (PR #121203)

2024-12-28 Thread Balazs Benics via cfe-commits
@@ -283,10 +283,12 @@ static bool shouldCompletelyUnroll(const Stmt *LoopStmt, ASTContext &ASTCtx, llvm::APInt InitNum = Matches[0].getNodeAs("initNum")->getValue(); auto CondOp = Matches[0].getNodeAs("conditionOperator"); - if (InitNum.getBitWidth() != BoundNum.get

[clang] [analyzer] Fix zext assertion failure in loop unrolling (PR #121203)

2024-12-28 Thread Balazs Benics via cfe-commits
@@ -283,10 +283,12 @@ static bool shouldCompletelyUnroll(const Stmt *LoopStmt, ASTContext &ASTCtx, llvm::APInt InitNum = Matches[0].getNodeAs("initNum")->getValue(); auto CondOp = Matches[0].getNodeAs("conditionOperator"); - if (InitNum.getBitWidth() != BoundNum.get

[clang] [analyzer] Fix zext assertion failure in loop unrolling (PR #121203)

2024-12-28 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. Looks wonderful now. I had recommended one simplification, but other than that we can merge this. Thanks again! https://github.com/llvm/llvm-project/pull/121203 ___ cfe-commits mailing list cfe-c

[clang] [analyzer] Fix zext assertion failure in loop unrolling (PR #121203)

2024-12-28 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/121203 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Fix zext assertion failure in loop unrolling (PR #121203)

2024-12-27 Thread Balazs Benics via cfe-commits
@@ -283,10 +283,12 @@ static bool shouldCompletelyUnroll(const Stmt *LoopStmt, ASTContext &ASTCtx, llvm::APInt InitNum = Matches[0].getNodeAs("initNum")->getValue(); auto CondOp = Matches[0].getNodeAs("conditionOperator"); - if (InitNum.getBitWidth() != BoundNum.get

[clang] [analyzer] Fix zext assertion failure in loop unrolling (PR #121203)

2024-12-27 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: Thanks for the nice reproducer! The test looks a bit verbose to my taste, but it's okay as-is. I had some deeper thoughts of the fix inline to settle before we could merge this. Thanks again for working on this issue! https://github.com/llvm/llvm-project/

[clang] [analyzer] Fix zext assertion failure in loop unrolling (PR #121203)

2024-12-27 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/121203 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Fix zext assertion failure in loop unrolling (PR #121203)

2024-12-27 Thread Balazs Benics via cfe-commits
steakhal wrote: Could you please add a RUN line to the test, and a `// no-crash` comment at the line where previously crashed during interpretation? I'd also prefer a `clang-formated` test file if possible. Are you sure the test case is minimal and couldn't be minimized further now that you kno

[clang] [analyzer] Fix zext assertion failure in loop unrolling (PR #121203)

2024-12-27 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/121203 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Fix zext assertion failure in loop unrolling (PR #121203)

2024-12-27 Thread Balazs Benics via cfe-commits
steakhal wrote: Hey, could you add a test for this PR that would crash on main, but wouldn't with this patch? https://github.com/llvm/llvm-project/pull/121203 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailm

[clang] [analyzer] Handle [[assume(cond)]] as __builtin_assume(cond) (PR #116462)

2024-12-27 Thread Balazs Benics via cfe-commits
steakhal wrote: So we had the following assertion failure: ``` clang/lib/Analysis/ThreadSafety.cpp:529: LocalVariableMap::addDefinition: Assertion `!Ctx.contains(D)' failed. ``` On `libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/pstl.fill_n.pass.cpp`. I wish I could come back to

[clang] [analyzer] Simplify CallEvent castArgToParamTypeIfNeeded (PR #120981)

2024-12-24 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/120981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Simplify CallEvent castArgToParamTypeIfNeeded (PR #120981)

2024-12-23 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/120981 I noticed recently that this code (that I wrote xD) uses the `getRuntimeDefinition()` which isn't quite necessary for the simple task this function was designed for. Why would it be better not using this API

[clang] [clang analyzer]consume `llvm::Error` (PR #120597)

2024-12-19 Thread Balazs Benics via cfe-commits
steakhal wrote: How did you notice this? If its from a real case then we could add a regression test for this too. https://github.com/llvm/llvm-project/pull/120597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] [analyzer] Handle [[assume(cond)]] as __builtin_assume(cond) (PR #116462)

2024-12-19 Thread Balazs Benics via cfe-commits
steakhal wrote: > I've reverted it in > https://github.com/llvm/llvm-project/commit/2b9abf0db2d106c7208b4372e662ef5df869e6f1 > to clear up some buildbots Thanks! Ill have a look later. https://github.com/llvm/llvm-project/pull/116462 ___ cfe-commits

[clang] [analyzer] Sink execution if the assumption of [[assume]] is false (PR #120572)

2024-12-19 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/120572 >From 097d7feb474e7eca884730dc8eebbb8b1bdef2e1 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Thu, 19 Dec 2024 13:45:58 +0100 Subject: [PATCH 1/2] [analyzer] Model [[assume]] attributes without side-ffects

[clang] [analyzer] Sink execution if the assumption of [[assume]] is false (PR #120572)

2024-12-19 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/120572 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Handle [[assume(cond)]] as __builtin_assume(cond) (PR #116462)

2024-12-19 Thread Balazs Benics via cfe-commits
steakhal wrote: I made the followup for this one in #120572 https://github.com/llvm/llvm-project/pull/116462 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Model [[assume]] attributes without side-effects (PR #120572)

2024-12-19 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/120572 This PR splits the existing modeling of builtin assume from the BuiltinFunctionChecker. We just sink the execution path if we are about to leave the assume expression with a false assumption. Assumptions with

[clang] [analyzer] Handle [[assume(cond)]] as __builtin_assume(cond) (PR #116462)

2024-12-19 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/116462 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Migrate {SymInt, IntSym}Expr to use APSIntPtr (4/4) (PR #120438)

2024-12-19 Thread Balazs Benics via cfe-commits
steakhal wrote: ### Merge activity * **Dec 19, 7:01 AM EST**: A user merged this pull request with [Graphite](https://app.graphite.dev/github/pr/llvm/llvm-project/120438). https://github.com/llvm/llvm-project/pull/120438 ___ cfe-commits mailing list

[clang] [analyzer][NFC] Migrate {SymInt, IntSym}Expr to use APSIntPtr (4/4) (PR #120438)

2024-12-19 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/120438 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

  1   2   3   4   5   6   7   8   9   10   >