[Bug target/82158] _Noreturn functions that do return clobber caller's registers on ARM32 (but not other arches)

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Sep 21 09:57:00 GMT 2017


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
None of the above options is IMHO acceptable.
This is UB like any other.

What we could add is -fsanitize=noreturn that would add runtime instrumentation
that noreturn functions don't return, but it certainly shouldn't be the
default, it can be included in -fsanitize=undefined to catch for that UB like
any other UB it catches.
Compile time error is undesirable, it isn't an error if a noreturn function
could return, the error is if it does return at runtime, which you really can't
prove.  Either the function isn't called in the program, or say the return is
only conditional and that path doesn't ever happen in a valid program, or say
there are calls in the noreturn function that just throw exceptions or loop
forever or abort or don't really return some other way.


More information about the Gcc-bugs mailing list