Commit 3ed67fbf by Jakub Jelinek Committed by Jakub Jelinek

re PR sanitizer/78158 (Strange data race detection with thread sanitizer)

	PR sanitizer/78158
	* tsan.c (instrument_builtin_call): If the memory model argument
	is not a constant, assume it is valid.

From-SVN: r246306
parent 9f30dff0
2017-03-21 Jakub Jelinek <jakub@redhat.com> 2017-03-21 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/78158
* tsan.c (instrument_builtin_call): If the memory model argument
is not a constant, assume it is valid.
PR c/67338 PR c/67338
* fold-const.c (round_up_loc): Negate divisor in unsigned type to * fold-const.c (round_up_loc): Negate divisor in unsigned type to
avoid UB. avoid UB.
......
...@@ -499,8 +499,8 @@ instrument_builtin_call (gimple_stmt_iterator *gsi) ...@@ -499,8 +499,8 @@ instrument_builtin_call (gimple_stmt_iterator *gsi)
case check_last: case check_last:
case fetch_op: case fetch_op:
last_arg = gimple_call_arg (stmt, num - 1); last_arg = gimple_call_arg (stmt, num - 1);
if (!tree_fits_uhwi_p (last_arg) if (tree_fits_uhwi_p (last_arg)
|| memmodel_base (tree_to_uhwi (last_arg)) >= MEMMODEL_LAST) && memmodel_base (tree_to_uhwi (last_arg)) >= MEMMODEL_LAST)
return; return;
gimple_call_set_fndecl (stmt, decl); gimple_call_set_fndecl (stmt, decl);
update_stmt (stmt); update_stmt (stmt);
...@@ -564,11 +564,11 @@ instrument_builtin_call (gimple_stmt_iterator *gsi) ...@@ -564,11 +564,11 @@ instrument_builtin_call (gimple_stmt_iterator *gsi)
gcc_assert (num == 6); gcc_assert (num == 6);
for (j = 0; j < 6; j++) for (j = 0; j < 6; j++)
args[j] = gimple_call_arg (stmt, j); args[j] = gimple_call_arg (stmt, j);
if (!tree_fits_uhwi_p (args[4]) if (tree_fits_uhwi_p (args[4])
|| memmodel_base (tree_to_uhwi (args[4])) >= MEMMODEL_LAST) && memmodel_base (tree_to_uhwi (args[4])) >= MEMMODEL_LAST)
return; return;
if (!tree_fits_uhwi_p (args[5]) if (tree_fits_uhwi_p (args[5])
|| memmodel_base (tree_to_uhwi (args[5])) >= MEMMODEL_LAST) && memmodel_base (tree_to_uhwi (args[5])) >= MEMMODEL_LAST)
return; return;
update_gimple_call (gsi, decl, 5, args[0], args[1], args[2], update_gimple_call (gsi, decl, 5, args[0], args[1], args[2],
args[4], args[5]); args[4], args[5]);
...@@ -642,8 +642,8 @@ instrument_builtin_call (gimple_stmt_iterator *gsi) ...@@ -642,8 +642,8 @@ instrument_builtin_call (gimple_stmt_iterator *gsi)
return; return;
} }
last_arg = gimple_call_arg (stmt, num - 1); last_arg = gimple_call_arg (stmt, num - 1);
if (!tree_fits_uhwi_p (last_arg) if (tree_fits_uhwi_p (last_arg)
|| memmodel_base (tree_to_uhwi (last_arg)) >= MEMMODEL_LAST) && memmodel_base (tree_to_uhwi (last_arg)) >= MEMMODEL_LAST)
return; return;
t = TYPE_ARG_TYPES (TREE_TYPE (decl)); t = TYPE_ARG_TYPES (TREE_TYPE (decl));
t = TREE_VALUE (TREE_CHAIN (t)); t = TREE_VALUE (TREE_CHAIN (t));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment