https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49754
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=95848 Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #8 from Martin Sebor <msebor at gcc dot gnu.org> --- GCC 11 (and prior) diagnose both functions in comment #0, I suspect as a result of r156156: pr49754.c: In function ‘foo’: pr49754.c:2:38: warning: ‘x’ is used uninitialized [-Wuninitialized] 2 | struct i foo () { struct i x; return x; } | ^ pr49754.c:2:28: note: ‘x’ declared here 2 | struct i foo () { struct i x; return x; } | ^ pr49754.c: In function ‘bar’: pr49754.c:3:28: warning: ‘y’ is used uninitialized [-Wuninitialized] 3 | int bar () { int y; return +y; } | ^~ Returning larger aggregates started to be diagnosed in r245840. Passing structs to other functions by value still isn't diagnosed. It used to be, but it stopped sometime between r143699 and r143725. See pr95848 that tracks the problem with pass-by-value.