https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93644
Jochen Roemmler <jochen447 at concept dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jochen447 at concept dot de --- Comment #16 from Jochen Roemmler <jochen447 at concept dot de> --- Created attachment 50739 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50739&action=edit another minimal example to demonstrate the false alarm This is another instance of the test case. A senseless, yet perfectly valid piece of C code. It creates the false positive warning if compiled like this: gcc -Wreturn-local-addr -O1 -fisolate-erroneous-paths-dereference -c pr93644_2.c pr93644_2.c: In function ‘buildVname’: pr93644_2.c:28:12: warning: function may return address of local variable [-Wreturn-local-addr] 28 | return vname; | ^~~~~ pr93644_2.c:18:17: note: declared here 18 | char buf[256]; | ^~~ I'm using gcc version 11.1.1 20210428 (Red Hat 11.1.1-1) (GCC) However, I can silence the warning using # pragma GCC diagnostic ignored "-Wreturn-local-addr"