[clang] [analyzer] Remove some false negatives in StackAddrEscapeChecker (PR #125638)

Michael Flanders via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 7 09:57:00 PST 2025


================
@@ -912,3 +924,33 @@ void top_malloc_no_crash_fn() {
   free(pptr);
 }
 } // namespace alloca_region_pointer
+
+namespace true_negatives_return_expressions {
+struct Container { int *x; };
+
+int test2() {
+  int x = 14;
----------------
Flandini wrote:

I also added a similar test case in 029d1228f65420b6b961929fe8222f427d7af7a7 that is giving a false negative on the return expression checking:

```
void ***param_ptr_to_ptr_to_ptr_return(void ***ppp) {
  int local = 0;
  **ppp = &local;
  return ppp;
  // expected-warning at -1 {{Address of stack memory associated with local variable 'local' is still referred to by the caller variable 'ppp' upon returning to the caller.  This will be a dangling reference}}
}
```

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


More information about the cfe-commits mailing list