[committed] Fix -fsanitize=undefined with non-C family FEs (PR sanitizer/60557)

Jakub Jelinek jakub@redhat.com
Tue Mar 18 19:17:00 GMT 2014


Hi!

While most of the sanitization is done in the FEs (c-family/),
some is done in the middle-end (ubsan pass) or when folding
__builtin_unreachable ().

This patch fixes ICE with that, bootstrapped/regtested on x86_64-linux and
i686-linux, committed to trunk as obvious.

2014-03-18  Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/60557
	* ubsan.c (ubsan_instrument_unreachable): Call
	initialize_sanitizer_builtins.
	(ubsan_pass): Likewise.

--- gcc/ubsan.c.jj	2014-03-17 20:01:34.000000000 +0100
+++ gcc/ubsan.c	2014-03-18 07:14:50.889409415 +0100
@@ -512,6 +512,7 @@ ubsan_create_data (const char *name, loc
 tree
 ubsan_instrument_unreachable (location_t loc)
 {
+  initialize_sanitizer_builtins ();
   tree data = ubsan_create_data ("__ubsan_unreachable_data", loc, NULL,
 				 NULL_TREE);
   tree t = builtin_decl_explicit (BUILT_IN_UBSAN_HANDLE_BUILTIN_UNREACHABLE);
@@ -847,6 +848,8 @@ ubsan_pass (void)
   basic_block bb;
   gimple_stmt_iterator gsi;
 
+  initialize_sanitizer_builtins ();
+
   FOR_EACH_BB_FN (bb, cfun)
     {
       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)

	Jakub



More information about the Gcc-patches mailing list