diff mbox

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

Message ID 20140318150812.GW22862@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek March 18, 2014, 3:08 p.m. UTC
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.


	Jakub
diff mbox

Patch

--- 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);)