aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/builtins.cc')
-rw-r--r--gcc/builtins.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index 971b18c..e6816d5 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -5184,6 +5184,9 @@ expand_builtin_trap (void)
static void
expand_builtin_unreachable (void)
{
+ /* Use gimple_build_builtin_unreachable or builtin_decl_unreachable
+ to avoid this. */
+ gcc_checking_assert (!sanitize_flags_p (SANITIZE_UNREACHABLE));
emit_barrier ();
}
@@ -9261,6 +9264,12 @@ fold_builtin_0 (location_t loc, tree fndecl)
case BUILT_IN_CLASSIFY_TYPE:
return fold_builtin_classify_type (NULL_TREE);
+ case BUILT_IN_UNREACHABLE:
+ /* Rewrite any explicit calls to __builtin_unreachable. */
+ if (sanitize_flags_p (SANITIZE_UNREACHABLE))
+ return build_builtin_unreachable (loc);
+ break;
+
default:
break;
}