diff options
author | Marek Polacek <polacek@redhat.com> | 2014-06-30 13:15:20 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2014-06-30 13:15:20 +0000 |
commit | 6a7253a4a9d6087827414eeee7036d9eb4b1e472 (patch) | |
tree | d9fbba8c55ca2e01e66ea39234d507306dac9bed /gcc/convert.c | |
parent | 670d96d7307b8cfa23000c050fe35c1298301cb4 (diff) |
convert.c (convert_to_integer): Don't instrument conversions if the function has no_sanitize_undefined attribute.
* convert.c (convert_to_integer): Don't instrument conversions if the
function has no_sanitize_undefined attribute.
* ubsan.c: Don't run the ubsan pass if the function has
no_sanitize_undefined attribute.
c/
* c-decl.c (grokdeclarator): Don't instrument VLAs if the function
has no_sanitize_undefined attribute.
cp/
* cp-gimplify.c (cp_genericize): Don't instrument returns if the
function has no_sanitize_undefined attribute.
* decl.c (compute_array_index_type): Don't instrument VLAs if the
function has no_sanitize_undefined attribute.
testsuite/
* c-c++-common/ubsan/attrib-2.c: New test.
* g++.dg/ubsan/return-3.C: New test.
From-SVN: r212148
Diffstat (limited to 'gcc/convert.c')
-rw-r--r-- | gcc/convert.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/convert.c b/gcc/convert.c index 2d9600dd853..09bc555ee0e 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -847,7 +847,10 @@ convert_to_integer (tree type, tree expr) return build1 (CONVERT_EXPR, type, expr); case REAL_TYPE: - if (flag_sanitize & SANITIZE_FLOAT_CAST) + if (flag_sanitize & SANITIZE_FLOAT_CAST + && current_function_decl != NULL_TREE + && !lookup_attribute ("no_sanitize_undefined", + DECL_ATTRIBUTES (current_function_decl))) { expr = save_expr (expr); tree check = ubsan_instrument_float_cast (loc, type, expr); |