From: Jakub Jelinek Date: Mon, 15 Dec 2014 09:50:11 +0000 (+0100) Subject: re PR sanitizer/64265 (r217669 broke tsan) X-Git-Tag: releases/gcc-4.8.4~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3604aeced769879c0fe618d62770b03ef0dda8e;p=thirdparty%2Fgcc.git re PR sanitizer/64265 (r217669 broke tsan) PR sanitizer/64265 * tsan.c (instrument_func_entry): Insert __tsan_func_entry call on edge from entry block to single succ instead of after labels of single succ of entry block. From-SVN: r218736 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fc3b03ef2cff..449099e6b1ac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-12-15 Jakub Jelinek + + PR sanitizer/64265 + * tsan.c (instrument_func_entry): Insert __tsan_func_entry + call on edge from entry block to single succ instead + of after labels of single succ of entry block. + 2014-12-13 Jakub Jelinek Backported from mainline diff --git a/gcc/tsan.c b/gcc/tsan.c index a3b65650e383..01ca69e93fdf 100644 --- a/gcc/tsan.c +++ b/gcc/tsan.c @@ -644,25 +644,24 @@ instrument_memory_accesses (void) static void instrument_func_entry (void) { - basic_block succ_bb; - gimple_stmt_iterator gsi; tree ret_addr, builtin_decl; gimple g; - - succ_bb = single_succ (ENTRY_BLOCK_PTR); - gsi = gsi_after_labels (succ_bb); + gimple_seq seq = NULL; builtin_decl = builtin_decl_implicit (BUILT_IN_RETURN_ADDRESS); g = gimple_build_call (builtin_decl, 1, integer_zero_node); ret_addr = make_ssa_name (ptr_type_node, NULL); gimple_call_set_lhs (g, ret_addr); gimple_set_location (g, cfun->function_start_locus); - gsi_insert_before (&gsi, g, GSI_SAME_STMT); + gimple_seq_add_stmt_without_update (&seq, g); - builtin_decl = builtin_decl_implicit (BUILT_IN_TSAN_FUNC_ENTRY); + builtin_decl = builtin_decl_implicit (BUILT_IN_TSAN_FUNC_ENTRY); g = gimple_build_call (builtin_decl, 1, ret_addr); gimple_set_location (g, cfun->function_start_locus); - gsi_insert_before (&gsi, g, GSI_SAME_STMT); + gimple_seq_add_stmt_without_update (&seq, g); + + edge e = single_succ_edge (ENTRY_BLOCK_PTR); + gsi_insert_seq_on_edge_immediate (e, seq); } /* Instruments function exits. */