summaryrefslogtreecommitdiff
path: root/gcc/convert.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-08 21:27:22 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-08 21:27:22 +0000
commit411b7663dae7bb6158fa94c6c1214be5215f8864 (patch)
treecbafc576a2a3a432c0727f066088eb9aa5369156 /gcc/convert.c
parent2b9b77fb15e7f041e548b779c9db2665dce6844f (diff)
downloadgcc-411b7663dae7bb6158fa94c6c1214be5215f8864.tar.gz
gcc/
* ubsan.c (do_ubsan_in_current_function): New. (pass_ubsan::gate): Use it. * ubsan.h: Declare it. * convert.c (convert_to_integer): Use it. gcc/c-family/ * c-ubsan.c (ubsan_maybe_instrument_array_ref): Use do_ubsan_in_current_function. (ubsan_maybe_instrument_reference_or_call): Likewise. * c-ubsan.h: Declare it. gcc/cp/ * cp-gimplify.c (cp_genericize): Use do_ubsan_in_current_function. * decl.c (compute_array_index_type): Likewise. * init.c (build_vec_init): Likewise. * typeck.c (cp_build_binary_op): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219360 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/convert.c')
-rw-r--r--gcc/convert.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/gcc/convert.c b/gcc/convert.c
index 0491986bd1e..fc1b93c225b 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -885,9 +885,7 @@ convert_to_integer (tree type, tree expr)
case REAL_TYPE:
if (flag_sanitize & SANITIZE_FLOAT_CAST
- && current_function_decl != NULL_TREE
- && !lookup_attribute ("no_sanitize_undefined",
- DECL_ATTRIBUTES (current_function_decl)))
+ && do_ubsan_in_current_function ())
{
expr = save_expr (expr);
tree check = ubsan_instrument_float_cast (loc, type, expr, expr);