[clang] [analyzer] Match dangling subobjects by their base region in DanglingPtrDeref (PR #211552)
Gábor Horváth via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 23 07:22:55 PDT 2026
================
@@ -112,3 +112,56 @@ void inlined_callee_single_report() {
// expected-note at -1 {{Calling 'deref_param'}}
(void)r;
}
+
+struct MyBuffer {
+ char buffer[8];
+};
+
+void member_subregion_dangling_deref() {
+ const char *p = nullptr;
+ {
+ struct MyBuffer tmp_buffer = {};
+ p = tmp_buffer.buffer;
----------------
Xazax-hun wrote:
Could we maybe add some pointer arithmetic, so we don't only point to the first element of the array?
https://github.com/llvm/llvm-project/pull/211552
More information about the cfe-commits
mailing list