https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71924
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- Returning [the address of] a compound literal, or any indirectly referenced object (such as those in comment #1), suffers from the same limitation. Compiling the program with -O2 (but not -O1) does produce the expected warnings. Since the effect of optimization is not documented, a "fix" might be as simple as updating the manual to mention the dependency.