asan.c (initialize_sanitizer_builtins): Add BT_FN_VOID_UINT8_UINT8...
authorWish Wu <wishwu007@gmail.com>
Wed, 6 Sep 2017 14:30:46 +0000 (14:30 +0000)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 6 Sep 2017 14:30:46 +0000 (16:30 +0200)
commitf6e50a7d64e9b165b54ed3e333a6793a0183c77e
treea8dd0e66bf4e2c57b0422c8dc9ed9ab8e9e1ebfd
parent181613096914e3791c7ae68ad53a2fae571b9c5f
asan.c (initialize_sanitizer_builtins): Add BT_FN_VOID_UINT8_UINT8...

* asan.c (initialize_sanitizer_builtins): Add
BT_FN_VOID_UINT8_UINT8, BT_FN_VOID_UINT16_UINT16,
BT_FN_VOID_UINT32_UINT32, BT_FN_VOID_UINT64_UINT64,
BT_FN_VOID_FLOAT_FLOAT, BT_FN_VOID_DOUBLE_DOUBLE and
BT_FN_VOID_UINT64_PTR variables.
* builtin-types.def (BT_FN_VOID_UINT8_UINT8): New fn type.
(BT_FN_VOID_UINT16_UINT16): Likewise.
(BT_FN_VOID_UINT32_UINT32): Likewise.
(BT_FN_VOID_FLOAT_FLOAT): Likewise.
(BT_FN_VOID_DOUBLE_DOUBLE): Likewise.
(BT_FN_VOID_UINT64_PTR): Likewise.
* common.opt (flag_sanitize_coverage): New variable.
(fsanitize-coverage=trace-pc): Remove.
(fsanitize-coverage=): Add.
* flag-types.h (enum sanitize_coverage_code): New enum.
* fold-const.c (fold_range_test): Disable non-short-circuit
optimization if flag_sanitize_coverage.
(fold_truth_andor): Likewise.
* tree-ssa-ifcombine.c (ifcombine_ifandif): Likewise.
* opts.c (COVERAGE_SANITIZER_OPT): Define.
(coverage_sanitizer_opts): New array.
(get_closest_sanitizer_option): Add OPTS argument, handle also
OPT_fsanitize_coverage_.
(parse_sanitizer_options): Adjusted to also handle
OPT_fsanitize_coverage_.
(common_handle_option): Add OPT_fsanitize_coverage_.
* sancov.c (instrument_comparison, instrument_switch): New function.
(sancov_pass): Add trace-cmp support.
* sanitizer.def (BUILT_IN_SANITIZER_COV_TRACE_CMP1,
BUILT_IN_SANITIZER_COV_TRACE_CMP2, BUILT_IN_SANITIZER_COV_TRACE_CMP4,
BUILT_IN_SANITIZER_COV_TRACE_CMP8,
BUILT_IN_SANITIZER_COV_TRACE_CONST_CMP1,
BUILT_IN_SANITIZER_COV_TRACE_CONST_CMP2,
BUILT_IN_SANITIZER_COV_TRACE_CONST_CMP4,
BUILT_IN_SANITIZER_COV_TRACE_CONST_CMP8,
BUILT_IN_SANITIZER_COV_TRACE_CMPF, BUILT_IN_SANITIZER_COV_TRACE_CMPD,
BUILT_IN_SANITIZER_COV_TRACE_SWITCH): New builtins.
* doc/invoke.texi: Document -fsanitize-coverage=trace-cmp.

* gcc.dg/sancov/cmp0.c: New test.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r251801
13 files changed:
gcc/ChangeLog
gcc/asan.c
gcc/builtin-types.def
gcc/common.opt
gcc/doc/invoke.texi
gcc/flag-types.h
gcc/fold-const.c
gcc/opts.c
gcc/sancov.c
gcc/sanitizer.def
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/sancov/cmp0.c [new file with mode: 0644]
gcc/tree-ssa-ifcombine.c