[Bug middle-end/113066] Returning from a function marked noreturn allows execution to fall-through

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Dec 18 15:34:46 GMT 2023


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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC does warn not just once but twice:
```
<source>: In function 'ub_if_reached':
<source>:2:44: warning: function declared 'noreturn' has a 'return' statement
    2 | [[noreturn]] inline void ub_if_reached() { return; }
      |                                            ^~~~~~
<source>:2:44: warning: 'noreturn' function does return
    2 | [[noreturn]] inline void ub_if_reached() { return; }
      |                                            ^
```


More information about the Gcc-bugs mailing list