https://bugs.llvm.org/show_bug.cgi?id=32158

Richard Smith <richard-l...@metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |richard-l...@metafoo.co.uk
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Richard Smith <richard-l...@metafoo.co.uk> ---
A compiler is not permitted to reject a program merely because some function in
it unconditionally evokes undefined behavior.

For user convenience, at -O0 we insert a trap instruction at the end of such a
function, and at -O1 and above we optimize on the basis that the end of the
function is unreachable if there is a missing 'return' statement.

In Clang 4, you can use -fno-strict-return to instead request that the function
returns uninitialized garbage when this happens. Obviously that's likely to
misbehave at runtime if the return value is used or the return type is not
trivially-destructible, but this can make sense for instance when compiling C
code as C++ (C has weaker rules in this area).


The proposed change in this bug (making -Wreturn-type an error by default)
would not be conforming; I'm marking this INVALID on that basis, but feel free
to reopen if you think there are still things that could be improved here.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to