https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10138
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org --- Comment #28 from Martin Sebor <msebor at gcc dot gnu.org> --- The patch I developed for pr80806 introduces the read_only and read_write attributes that both enable this warning and also make optimizations possible: $ cat pr10138.c && gcc -O -S -Wall pr10138.c __attribute__ ((read_only)) int atoi (const char *); int foo() { char buf[10]; return atoi (buf); } pr10138.c: In function ‘foo’: pr10138.c:6:10: warning: ‘buf’ is used uninitialized in this function [-Wuninitialized] 6 | return atoi (buf); | ^~~~~~~~~~ For read-only functions like atoi it would be easy to issue the warning even in the absence of the attribute. There's some potential for false positives, such as in C++ and mutable members, but I expect those would be rare and more than offset by the bugs the warning would find. Let me see about it.