================
@@ -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
+  // `MallocChecker::checkUseZeroAllocated()` cannot handle it; and we get an
+  // unrelated, but suitable warning from core.uninitialized.UndefReturn.
   char *p = alloca(0);
-  return *p; // expected-warning {{Use of memory allocated with size zero}}
+  return *p; // expected-warning {{Undefined or garbage value returned to 
caller}}
----------------
DonatNagyE wrote:

Ok, I'll test that.

Unfortunately this "allocated with size zero" report is based on the private 
"Symbol -> state enum" map that's maintained by MallocChecker (so it's 
independent of the dynamic extent). I'd guess that switching to dynamic extent 
wouldn't be too difficult and it could simplify the code, but I think that 
belongs to a separate commit.

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

Reply via email to