aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2013-09-18 10:01:40 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2013-09-18 10:01:40 +0000
commitce6923c53da68bc3e0eabb1d071217402a104148 (patch)
tree03f7c27c5287577987f7b1ef007495fd35f4beb0 /gcc/builtins.c
parentd30d00a2f1851cf6e6fe3b392a90b10e54388c20 (diff)
downloadgcc-ce6923c53da68bc3e0eabb1d071217402a104148.zip
gcc-ce6923c53da68bc3e0eabb1d071217402a104148.tar.gz
gcc-ce6923c53da68bc3e0eabb1d071217402a104148.tar.bz2
re PR sanitizer/58411 (no_sanitize_undefined function attribute)
2013-09-18 Marek Polacek <polacek@redhat.com> PR sanitizer/58411 * doc/extend.texi: Document no_sanitize_undefined attribute. * builtins.c (fold_builtin_0): Don't sanitize function if it has the no_sanitize_undefined attribute. From-SVN: r202682
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 0ab6d9b..d19ca68 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -10313,7 +10313,10 @@ fold_builtin_0 (location_t loc, tree fndecl, bool ignore ATTRIBUTE_UNUSED)
return fold_builtin_classify_type (NULL_TREE);
case BUILT_IN_UNREACHABLE:
- if (flag_sanitize & SANITIZE_UNREACHABLE)
+ if (flag_sanitize & SANITIZE_UNREACHABLE
+ && (current_function_decl == NULL
+ || !lookup_attribute ("no_sanitize_undefined",
+ DECL_ATTRIBUTES (current_function_decl))))
return ubsan_instrument_unreachable (loc);
break;