https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118588
Bug ID: 118588 Summary: -Wmaybe-uninitialized false positive Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: alx at kernel dot org Target Milestone: --- Is this supposed to trigger? It has been immediately assigned with the result of malloc(3). That is necessarily initialized (unless it assumes malloc(3) might be returning garbage, but that should be warned within malloc(3)'s body). alx@devuan:~/tmp/gcc$ cat u.c #include <stdlib.h> int foo(const void *); void f(void) { int *p; p = malloc(200); foo(p); free(p); return; } alx@devuan:~/tmp/gcc$ gcc-15 -Wall -Wextra -O3 -fanalyzer -S u.c u.c: In function ‘f’: u.c:11:9: warning: ‘p’ may be used uninitialized [-Wmaybe-uninitialized] 11 | foo(p); | ^~~~~~ u.c:3:5: note: by argument 1 of type ‘const void *’ to ‘foo’ declared here 3 | int foo(const void *); | ^~~