New syntax for -fsanitize-recover.
authorJakub Jelinek <jakub@redhat.com>
Wed, 22 Oct 2014 11:07:10 +0000 (13:07 +0200)
committerYury Gribov <ygribov@gcc.gnu.org>
Wed, 22 Oct 2014 11:07:10 +0000 (11:07 +0000)
commitd95a2703476dcbacd128577bb0c41b74588132b1
treef073707e8126a2ace9bb536a76fb513d5fe1121a
parent18a3415e239132c0273e306421147d79a7d3ae28
New syntax for -fsanitize-recover.

2014-10-22  Jakub Jelinek  <jakub@redhat.com>
    Yury Gribov  <y.gribov@samsung.com>

gcc/
* common.opt (flag_sanitize_recover): New variable.
(fsanitize-recover): Remove Var/Init, deprecate.
(fsanitize-recover=): New option.
* doc/invoke.texi (fsanitize-recover): Update docs.
* opts.c (finish_options): Use opts->x_flag_sanitize
instead of flag_sanitize.  Prohibit -fsanitize-recover
for anything besides UBSan.  Formatting.
(common_handle_option): Handle OPT_fsanitize_recover_
and OPT_fsanitize_recover.  Use opts->x_flag_sanitize
instead of flag_sanitize.
* asan.c (pass_sanopt::execute): Fix up formatting.
* ubsan.c (ubsan_expand_bounds_ifn, ubsan_expand_null_ifn,
ubsan_expand_objsize_ifn, ubsan_build_overflow_builtin,
instrument_bool_enum_load, ubsan_instrument_float_cast,
instrument_nonnull_arg, instrument_nonnull_return): Check
bits in flag_sanitize_recover bitmask instead of
flag_sanitize_recover as bool flag.

gcc/c-family/
* c-ubsan.c (ubsan_instrument_division, ubsan_instrument_shift,
ubsan_instrument_vla): Check bits in flag_sanitize_recover bitmask
instead of flag_sanitize_recover as bool flag.

gcc/testsuite/
* c-c++-common/ubsan/align-1.c: Update cmdline options.
* c-c++-common/ubsan/align-3.c: Likewise.
* c-c++-common/ubsan/bounds-1.c: Likewise.
* c-c++-common/ubsan/div-by-zero-7.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-7.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
* c-c++-common/ubsan/nonnull-2.c: Likewise.
* c-c++-common/ubsan/nonnull-3.c: Likewise.
* c-c++-common/ubsan/object-size-3.c: Likewise.
* c-c++-common/ubsan/overflow-1.c: Likewise.
* c-c++-common/ubsan/overflow-add-1.c: Likewise.
* c-c++-common/ubsan/overflow-add-3.c: Likewise.
* c-c++-common/ubsan/overflow-mul-1.c: Likewise.
* c-c++-common/ubsan/overflow-mul-3.c: Likewise.
* c-c++-common/ubsan/overflow-negate-2.c: Likewise.
* c-c++-common/ubsan/overflow-sub-1.c: Likewise.
* c-c++-common/ubsan/pr59503.c: Likewise.
* c-c++-common/ubsan/pr60613-1.c: Likewise.
* c-c++-common/ubsan/save-expr-1.c: Likewise.
* c-c++-common/ubsan/shift-3.c: Likewise.
* c-c++-common/ubsan/shift-6.c: Likewise.
* c-c++-common/ubsan/undefined-1.c: Likewise.
* c-c++-common/ubsan/vla-2.c: Likewise.
* c-c++-common/ubsan/vla-3.c: Likewise.
* c-c++-common/ubsan/vla-4.c: Likewise.
* g++.dg/ubsan/cxx11-shift-1.C: Likewise.
* g++.dg/ubsan/return-2.C: Likewise.
* c-c++-common/ubsan/recovery-1.c: New test.
* c-c++-common/ubsan/recovery-2.c: New test.
* c-c++-common/ubsan/recovery-3.c: New test.
* c-c++-common/ubsan/recovery-common.inc: New file.

Co-Authored-By: Yury Gribov <y.gribov@samsung.com>
From-SVN: r216552
42 files changed:
gcc/ChangeLog
gcc/asan.c
gcc/c-family/ChangeLog
gcc/c-family/c-ubsan.c
gcc/common.opt
gcc/doc/invoke.texi
gcc/opts.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/ubsan/align-1.c
gcc/testsuite/c-c++-common/ubsan/align-3.c
gcc/testsuite/c-c++-common/ubsan/bounds-1.c
gcc/testsuite/c-c++-common/ubsan/div-by-zero-7.c
gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-10.c
gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-7.c
gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-8.c
gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-9.c
gcc/testsuite/c-c++-common/ubsan/nonnull-2.c
gcc/testsuite/c-c++-common/ubsan/nonnull-3.c
gcc/testsuite/c-c++-common/ubsan/object-size-3.c
gcc/testsuite/c-c++-common/ubsan/overflow-1.c
gcc/testsuite/c-c++-common/ubsan/overflow-add-1.c
gcc/testsuite/c-c++-common/ubsan/overflow-add-3.c
gcc/testsuite/c-c++-common/ubsan/overflow-mul-1.c
gcc/testsuite/c-c++-common/ubsan/overflow-mul-3.c
gcc/testsuite/c-c++-common/ubsan/overflow-negate-2.c
gcc/testsuite/c-c++-common/ubsan/overflow-sub-1.c
gcc/testsuite/c-c++-common/ubsan/pr59503.c
gcc/testsuite/c-c++-common/ubsan/pr60613-1.c
gcc/testsuite/c-c++-common/ubsan/recovery-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/ubsan/recovery-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/ubsan/recovery-3.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/ubsan/recovery-common.inc [new file with mode: 0644]
gcc/testsuite/c-c++-common/ubsan/save-expr-1.c
gcc/testsuite/c-c++-common/ubsan/shift-3.c
gcc/testsuite/c-c++-common/ubsan/shift-6.c
gcc/testsuite/c-c++-common/ubsan/undefined-1.c
gcc/testsuite/c-c++-common/ubsan/vla-2.c
gcc/testsuite/c-c++-common/ubsan/vla-3.c
gcc/testsuite/c-c++-common/ubsan/vla-4.c
gcc/testsuite/g++.dg/ubsan/cxx11-shift-1.C
gcc/testsuite/g++.dg/ubsan/return-2.C
gcc/ubsan.c