Skip to content
Snippets Groups Projects
Commit 2c116623 authored by Jason Merrill's avatar Jason Merrill
Browse files

ubsan: -Wreturn-type and ubsan trap-on-error

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.

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.
parent 72b18518
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment