[clang] [analyzer][StackAddrEscapeChecker] Fix assert failure for alloca regions (PR #109655)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 23 05:59:50 PDT 2024
================
@@ -1,4 +1,9 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s -Wno-undefined-bool-conversion
+// RUN: %clang_analyze_cc1 \
+// RUN: -analyzer-checker=core,debug.ExprInspection,unix.Malloc \
+// RUN: -verify %s \
+// RUN: -Wno-undefined-bool-conversion
+// unix.Malloc is necessary to model __builtin_alloca,
+// which could trigger an "unexpected region" bug in StackAddrEscapeChecker.
----------------
NagyDonat wrote:
Malloc / etc. modeling should not be a dependency of `StackAddrEscapeChecker` (and in particular the `unix.Malloc` part of `MallocChecker` cannot be a strong dependency of anything, because it can generate reports, while only modeling checkers may be dependencies of other checkers).
I don't think that we __need__ a separate testcase to see that `StackAddrEscapeChecker` does not crash on `__builtin_alloca` when `unix.Malloc` is not enabled -- the reason for this crash was that `unix.Malloc` introduced an unusual region type (`AllocaRegion`) and without that modeling the return value of `__builtin_alloca` is just a generic conjured region which should be already covered by the many other testcases. However, I'm not opposed to adding that testcase if you would like to see it.
https://github.com/llvm/llvm-project/pull/109655
More information about the cfe-commits
mailing list