aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2015-03-09 11:57:33 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2015-03-09 11:57:33 +0000
commit802ac282f819054e10ac5dca06881b6dca909cdb (patch)
tree87c8562a9a465e2be6cfd41ae229a30fba710f11 /gcc
parente0d514da7ba05dabd279fee99a1ef8f40f098ab0 (diff)
downloadgcc-802ac282f819054e10ac5dca06881b6dca909cdb.zip
gcc-802ac282f819054e10ac5dca06881b6dca909cdb.tar.gz
gcc-802ac282f819054e10ac5dca06881b6dca909cdb.tar.bz2
c-convert.c (convert): Make use of do_ubsan_in_current_function.
* c-convert.c (convert): Make use of do_ubsan_in_current_function. * c-decl.c (grokdeclarator): Likewise. * c-typeck.c (build_binary_op): Likewise. From-SVN: r221278
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-convert.c4
-rw-r--r--gcc/c/c-decl.c5
-rw-r--r--gcc/c/c-typeck.c4
4 files changed, 9 insertions, 10 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 7152fc0..a5fcb35 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-09 Marek Polacek <polacek@redhat.com>
+
+ * c-convert.c (convert): Make use of do_ubsan_in_current_function.
+ * c-decl.c (grokdeclarator): Likewise.
+ * c-typeck.c (build_binary_op): Likewise.
+
2015-02-27 Marek Polacek <polacek@redhat.com>
PR c/65228
diff --git a/gcc/c/c-convert.c b/gcc/c/c-convert.c
index 2cb53f7..27fc3fc 100644
--- a/gcc/c/c-convert.c
+++ b/gcc/c/c-convert.c
@@ -121,9 +121,7 @@ convert (tree type, tree expr)
if (flag_sanitize & SANITIZE_FLOAT_CAST
&& TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
&& COMPLETE_TYPE_P (type)
- && current_function_decl != NULL_TREE
- && !lookup_attribute ("no_sanitize_undefined",
- DECL_ATTRIBUTES (current_function_decl)))
+ && do_ubsan_in_current_function ())
{
tree arg;
if (in_late_binary_op)
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 7497858..c140837 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -5837,10 +5837,7 @@ grokdeclarator (const struct c_declarator *declarator,
warn_variable_length_array (name, size);
if (flag_sanitize & SANITIZE_VLA
&& decl_context == NORMAL
- && current_function_decl != NULL_TREE
- && !lookup_attribute ("no_sanitize_undefined",
- DECL_ATTRIBUTES
- (current_function_decl)))
+ && do_ubsan_in_current_function ())
{
/* Evaluate the array size only once. */
size = c_save_expr (size);
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index a3a9c77..7c6d974 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -11229,9 +11229,7 @@ build_binary_op (location_t location, enum tree_code code,
if ((flag_sanitize & (SANITIZE_SHIFT | SANITIZE_DIVIDE
| SANITIZE_FLOAT_DIVIDE))
- && current_function_decl != 0
- && !lookup_attribute ("no_sanitize_undefined",
- DECL_ATTRIBUTES (current_function_decl))
+ && do_ubsan_in_current_function ()
&& (doing_div_or_mod || doing_shift))
{
/* OP0 and/or OP1 might have side-effects. */