Do UBSAN sanitization just when current_function_decl != NULL_TREE (PR sanitize/81530).
authorMartin Liska <mliska@suse.cz>
Mon, 31 Jul 2017 08:53:00 +0000 (10:53 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Mon, 31 Jul 2017 08:53:00 +0000 (08:53 +0000)
commitf34ebeb25ef25e5937f60b7e6115c3f693a12ac3
treebbf935d2f3780cbc507657f93feae23ae87fbd39
parent066bbc5721fbda2affe061fc4025a622bf30d5b5
Do UBSAN sanitization just when current_function_decl != NULL_TREE (PR sanitize/81530).

2017-07-31  Martin Liska  <mliska@suse.cz>

PR sanitize/81530
* cp-gimplify.c (cp_genericize): Guard condition with flag_sanitize_p
also with current_function_decl non-null equality.
* cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
* decl.c (compute_array_index_type): Likewise.
* init.c (finish_length_check): Likewise.
* typeck.c (cp_build_binary_op): Likewise.
2017-07-31  Martin Liska  <mliska@suse.cz>

PR sanitize/81530
* c-convert.c (convert): Guard condition with flag_sanitize_p
also with current_function_decl non-null equality.
* c-decl.c (grokdeclarator): Likewise.
* c-typeck.c (build_binary_op): Likewise.
2017-07-31  Martin Liska  <mliska@suse.cz>

PR sanitize/81530
* convert.c (convert_to_integer_1): Guard condition with flag_sanitize_p
also with current_function_decl non-null equality.
2017-07-31  Martin Liska  <mliska@suse.cz>

PR sanitize/81530
* c-ubsan.c (ubsan_maybe_instrument_array_ref):
Guard condition with flag_sanitize_p also with current_function_decl
non-null equality.
(ubsan_maybe_instrument_reference_or_call): Likewise.
2017-07-31  Martin Liska  <mliska@suse.cz>

PR sanitize/81530
* g++.dg/ubsan/pr81530.C: New test.

From-SVN: r250730
16 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-ubsan.c
gcc/c/ChangeLog
gcc/c/c-convert.c
gcc/c/c-decl.c
gcc/c/c-typeck.c
gcc/convert.c
gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c
gcc/cp/cp-ubsan.c
gcc/cp/decl.c
gcc/cp/init.c
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ubsan/pr81530.C [new file with mode: 0644]