diff options
author | Richard Biener <rguenther@suse.de> | 2017-12-15 13:43:30 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-12-15 13:43:30 +0000 |
commit | 87a5e0e8c65c0066f497d54e88ff2c1dc6eb3a97 (patch) | |
tree | a442253ccfb98e3c85928b6d9227ba0d841b55f8 /gcc/lto-streamer-in.c | |
parent | fc47ef60c5d11d0302a4f4831080fde792430781 (diff) | |
download | gcc-87a5e0e8c65c0066f497d54e88ff2c1dc6eb3a97.zip gcc-87a5e0e8c65c0066f497d54e88ff2c1dc6eb3a97.tar.gz gcc-87a5e0e8c65c0066f497d54e88ff2c1dc6eb3a97.tar.bz2 |
re PR sanitizer/83388 (reference statement index not found error with -fsanitize=null)
2017-12-15 Richard Biener <rguenther@suse.de>
PR lto/83388
* internal-fn.def (IFN_NOP): Add.
* internal-fn.c (expand_NOP): Do nothing.
* lto-streamer-in.c (input_function): Instead of removing
sanitizer calls replace them with IFN_NOP calls.
* gcc.dg/lto/pr83388_0.c: New testcase.
From-SVN: r255694
Diffstat (limited to 'gcc/lto-streamer-in.c')
-rw-r--r-- | gcc/lto-streamer-in.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 9b785ff..a313b25 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -1136,41 +1136,47 @@ input_function (tree fn_decl, struct data_in *data_in, if (is_gimple_call (stmt) && gimple_call_internal_p (stmt)) { + bool replace = false; switch (gimple_call_internal_fn (stmt)) { case IFN_UBSAN_NULL: if ((flag_sanitize & (SANITIZE_NULL | SANITIZE_ALIGNMENT)) == 0) - remove = true; + replace = true; break; case IFN_UBSAN_BOUNDS: if ((flag_sanitize & SANITIZE_BOUNDS) == 0) - remove = true; + replace = true; break; case IFN_UBSAN_VPTR: if ((flag_sanitize & SANITIZE_VPTR) == 0) - remove = true; + replace = true; break; case IFN_UBSAN_OBJECT_SIZE: if ((flag_sanitize & SANITIZE_OBJECT_SIZE) == 0) - remove = true; + replace = true; break; case IFN_UBSAN_PTR: if ((flag_sanitize & SANITIZE_POINTER_OVERFLOW) == 0) - remove = true; + replace = true; break; case IFN_ASAN_MARK: if ((flag_sanitize & SANITIZE_ADDRESS) == 0) - remove = true; + replace = true; break; case IFN_TSAN_FUNC_EXIT: if ((flag_sanitize & SANITIZE_THREAD) == 0) - remove = true; + replace = true; break; default: break; } - gcc_assert (!remove || gimple_call_lhs (stmt) == NULL_TREE); + if (replace) + { + gimple_call_set_internal_fn (as_a <gcall *> (stmt), + IFN_NOP); + update_stmt (stmt); + } } } if (remove) |