https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115125
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Nikolai Ivanenko from comment #1) > Forgot to mention that the the code commented out in main compiles without > warnings. That is just due to inlining differences. Afterwards if you rename main to f and change the return type to void, you get back the warnings. GCC is less agressive at inlining into main (unless the call is inside a loop) as GCC knows that function call is only happens once.