diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-12-02 08:57:04 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-12-02 08:57:04 +0100 |
commit | 38651b523d2df78a62489911e1c0036847c116bd (patch) | |
tree | a6a292ec23bf2fe057bf4eb6a51b0cffc2b86ed9 /gcc/tree-cfg.c | |
parent | e034c5c895722e0092d2239cd8c2991db77d6d39 (diff) | |
download | gcc-38651b523d2df78a62489911e1c0036847c116bd.zip gcc-38651b523d2df78a62489911e1c0036847c116bd.tar.gz gcc-38651b523d2df78a62489911e1c0036847c116bd.tar.bz2 |
re PR sanitizer/81212 (-Wreturn-type is disabled when used together with -fsanitize=return)
PR c++/81212
* tree-cfg.c (pass_warn_function_return::execute): Handle
__builtin_ubsan_handle_missing_return like __builtin_unreachable
with BUILTINS_LOCATION.
* g++.dg/ubsan/pr81212.C: New test.
* g++.dg/ubsan/return-1.C: Add -Wno-return-type to dg-options.
* g++.dg/ubsan/return-2.C: Likewise.
* g++.dg/ubsan/return-7.C: Likewise.
From-SVN: r255354
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 4fb4a83..2501a9c 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -9151,10 +9151,13 @@ pass_warn_function_return::execute (function *fun) if (EDGE_COUNT (bb->succs) == 0) { gimple *last = last_stmt (bb); + const enum built_in_function ubsan_missing_ret + = BUILT_IN_UBSAN_HANDLE_MISSING_RETURN; if (last - && (LOCATION_LOCUS (gimple_location (last)) - == BUILTINS_LOCATION) - && gimple_call_builtin_p (last, BUILT_IN_UNREACHABLE)) + && ((LOCATION_LOCUS (gimple_location (last)) + == BUILTINS_LOCATION + && gimple_call_builtin_p (last, BUILT_IN_UNREACHABLE)) + || gimple_call_builtin_p (last, ubsan_missing_ret))) { gimple_stmt_iterator gsi = gsi_for_stmt (last); gsi_prev_nondebug (&gsi); |