[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-28 Thread via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: https://github.com/DonatNagyE closed https://github.com/llvm/llvm-project/pull/72402 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-28 Thread via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: DonatNagyE wrote: I'm merging this commit in its current shape because even if I'd reimplement a warning for the "use of `alloc(0)`", I'd do it in a separate commit. I thought about potential approaches to implement

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-28 Thread Balazs Benics via cfe-commits
=?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. Overall, I'm in favor of this change. On the other hand, I'd urge for not to regress on the diagnostics. To me, `alloca` is like a VLA; which is prone to misuses,

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-24 Thread via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: https://github.com/DonatNagyE updated https://github.com/llvm/llvm-project/pull/72402 >From 703c06e2d6781c45e55d7021929a06cdb0275a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Wed, 15 Nov 2023

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-24 Thread via cfe-commits
=?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: DonatNagyE wrote: > I think the original `alloca(0)` warning message might be clearer/easier to > understand. The difficulty is that we switch from the `SymbolicRegion` that represents the heap allocation to an `AllocaRegion` that doesn't

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-23 Thread Gábor Horváth via cfe-commits
Xazax-hun wrote: I think the original `alloca(0)` warning message might be clearer/easier to understand. While it might have platform or compiler dependent meaning, those behaviors are non-portable, so I think it is undesirable in most cases and people probably want to be notified about it.

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-22 Thread via cfe-commits
=?utf-8?q?Don=C3=A1t?= Nagy Message-ID: In-Reply-To: DonatNagyE wrote: @haoNoQ What do you think about this commit? May I merge it? https://github.com/llvm/llvm-project/pull/72402 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-20 Thread via cfe-commits
=?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: https://github.com/DonatNagyE edited https://github.com/llvm/llvm-project/pull/72402 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-20 Thread via cfe-commits
=?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: @@ -81,22 +81,21 @@ bool BuiltinFunctionChecker::evalCall(const CallEvent , case Builtin::BI__builtin_alloca_with_align: case Builtin::BI__builtin_alloca: { -// FIXME: Refactor into StoreManager itself? -

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-20 Thread via cfe-commits
=?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: https://github.com/DonatNagyE updated https://github.com/llvm/llvm-project/pull/72402 >From 703c06e2d6781c45e55d7021929a06cdb0275a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Wed, 15 Nov 2023 16:03:22 +0100 Subject:

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-20 Thread via cfe-commits
@@ -266,13 +266,18 @@ void CheckUseZeroAllocated1(void) { } char CheckUseZeroAllocated2(void) { + // FIXME: The return value of `alloca()` is modeled with `AllocaRegion` + // instead of `SymbolicRegion`, so the current implementation of + //

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-20 Thread Endre Fülöp via cfe-commits
https://github.com/gamesh411 edited https://github.com/llvm/llvm-project/pull/72402 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-20 Thread Endre Fülöp via cfe-commits
@@ -266,13 +266,18 @@ void CheckUseZeroAllocated1(void) { } char CheckUseZeroAllocated2(void) { + // FIXME: The return value of `alloca()` is modeled with `AllocaRegion` + // instead of `SymbolicRegion`, so the current implementation of + //

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-20 Thread Endre Fülöp via cfe-commits
https://github.com/gamesh411 approved this pull request. LGTM, added two remarks inline, but those can be separate patches as well. https://github.com/llvm/llvm-project/pull/72402 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-20 Thread Endre Fülöp via cfe-commits
@@ -81,22 +81,21 @@ bool BuiltinFunctionChecker::evalCall(const CallEvent , case Builtin::BI__builtin_alloca_with_align: case Builtin::BI__builtin_alloca: { -// FIXME: Refactor into StoreManager itself? -MemRegionManager& RM =

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-16 Thread via cfe-commits
https://github.com/DonatNagyE edited https://github.com/llvm/llvm-project/pull/72402 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-16 Thread via cfe-commits
https://github.com/DonatNagyE edited https://github.com/llvm/llvm-project/pull/72402 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-16 Thread via cfe-commits
@@ -266,13 +266,18 @@ void CheckUseZeroAllocated1(void) { } char CheckUseZeroAllocated2(void) { + // FIXME: The return value of `alloca()` is modeled with `AllocaRegion` + // instead of `SymbolicRegion`, so the current implementation of + //

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-16 Thread via cfe-commits
DonatNagyE wrote: > Hmm, it really worries me that `MallocChecker` is setting a return value > outside of `evalCall()`. This can easily lead to conflicts if multiple > checkers try to do this: `evalCall()` is protected from conflicts (the engine > asserts that at most one checker evaluates

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-16 Thread via cfe-commits
@@ -266,13 +266,18 @@ void CheckUseZeroAllocated1(void) { } char CheckUseZeroAllocated2(void) { + // FIXME: The return value of `alloca()` is modeled with `AllocaRegion` + // instead of `SymbolicRegion`, so the current implementation of + //

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-15 Thread Artem Dergachev via cfe-commits
@@ -266,13 +266,18 @@ void CheckUseZeroAllocated1(void) { } char CheckUseZeroAllocated2(void) { + // FIXME: The return value of `alloca()` is modeled with `AllocaRegion` + // instead of `SymbolicRegion`, so the current implementation of + //

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-15 Thread Artem Dergachev via cfe-commits
haoNoQ wrote: Hmm, it really worries me that `MallocChecker` is setting a return value outside of `evalCall()`. This can easily lead to conflicts if multiple checkers try to do this: `evalCall()` is protected from conflicts (the engine asserts that at most one checker evaluates each call) but

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-15 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-static-analyzer-1 @llvm/pr-subscribers-clang Author: None (DonatNagyE) Changes ...to model the results of alloca() and _alloca() calls. Previously it acted as if these functions were returning memory from the heap, which led to

[clang] [analyzer] Use AllocaRegion in MallocChecker (PR #72402)

2023-11-15 Thread via cfe-commits
https://github.com/DonatNagyE created https://github.com/llvm/llvm-project/pull/72402 ...to model the results of alloca() and _alloca() calls. Previously it acted as if these functions were returning memory from the heap, which led to alpha.security.ArrayBoundV2 producing incorrect messages.