[clang] [analyzer][StackAddrEscapeChecker] Fix assert failure for alloca regions (PR #109655)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 23 05:49:18 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.
----------------
steakhal wrote:

Either make the `unix.Malloc` as a strong dependency of the `StackAddrEscapeChecker` (to get it enabled if it's enabled), or demonstrate that the `StackAddrEscapeChecker` would behave correctly (and not crash) if `unix.Malloc` is not enabled.

https://github.com/llvm/llvm-project/pull/109655


More information about the cfe-commits mailing list