[Bug c++/87515] "no return statement in function returning non-void" miscompiles with optimizations

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Oct 4 12:13:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87515

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |marxin at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r254437.
The code is invalid and we produce warning for it by default:

pr87515.cpp: In function ‘int blam(int)’:
pr87515.cpp:8:1: warning: no return statement in function returning non-void
[-Wreturn-type]
 }
 ^

Please add -Werror=return-type to your flags and you will find all problematic
places.


More information about the Gcc-bugs mailing list