On Mon, Jun 13, 2022 at 03:38:23PM -0400, Jason Merrill via Gcc-patches wrote:
> I noticed that -fsanitize=undefined -fsanitize-undefined-trap-on-error was
> omitting the usual -Wreturn-type warning for control flowing off the end of
> a function.  This was because the warning code was looking for calls either
> to __builtin_unreachable or the UBSan function, but these flags produce a
> call to __builtin_trap instead.
> 
> Tested x86_64-pc-linux-gnu, OK for trunk?
> 
> gcc/c-family/ChangeLog:
> 
>       * c-ubsan.cc (ubsan_instrument_return): Use BUILTINS_LOCATION.
> 
> gcc/ChangeLog:
> 
>       * tree-cfg.cc (pass_warn_function_return::execute): Also check
>       BUILT_IN_TRAP.
> 
> gcc/testsuite/ChangeLog:
> 
>       * g++.dg/ubsan/return-8.C: New test.

LGTM.

        Jakub

Reply via email to