diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-12-01 09:08:55 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-12-01 09:08:55 +0100 |
commit | 770cf505a1c1676f6d4c6968ddd05c5ea0f3af27 (patch) | |
tree | cece89b362ff715c734db5ac045dab5001b387c0 /gcc | |
parent | 852f7e6f4aa2b27986de5a522cd6638f0f1a74e7 (diff) | |
download | gcc-770cf505a1c1676f6d4c6968ddd05c5ea0f3af27.zip gcc-770cf505a1c1676f6d4c6968ddd05c5ea0f3af27.tar.gz gcc-770cf505a1c1676f6d4c6968ddd05c5ea0f3af27.tar.bz2 |
re PR sanitizer/83219 (c-c++-common/ubsan/unreachable-2.c fails starting with r255201)
PR sanitizer/83219
* tree-cfg.c: Include asan.h.
(gimple_seq_unreachable_p): Return false for -fsanitize=unreachable.
From-SVN: r255295
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e38b73f..e77936e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-12-01 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/83219 + * tree-cfg.c: Include asan.h. + (gimple_seq_unreachable_p): Return false for -fsanitize=unreachable. + 2017-12-01 Sergey Shalnov <Sergey.Shalnov@intel.com> * config/i386/i386.md: Fix AVX512 register width in AVX512 instruction. diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 2835a4b..92f3201 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -61,6 +61,7 @@ along with GCC; see the file COPYING3. If not see #include "attribs.h" #include "selftest.h" #include "opts.h" +#include "asan.h" /* This file contains functions for building the Control Flow Graph (CFG) for a function tree. */ @@ -469,7 +470,12 @@ computed_goto_p (gimple *t) bool gimple_seq_unreachable_p (gimple_seq stmts) { - if (stmts == NULL) + if (stmts == NULL + /* Return false if -fsanitize=unreachable, we don't want to + optimize away those calls, but rather turn them into + __ubsan_handle_builtin_unreachable () or __builtin_trap () + later. */ + || sanitize_flags_p (SANITIZE_UNREACHABLE)) return false; gimple_stmt_iterator gsi = gsi_last (stmts); |