From 0d5782429515e4abaa95a5e5be87a8998b3d9797 Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Mon, 5 Jan 2015 20:26:44 +0000 Subject: [PATCH] Enable experimental TSAN support for Ada. 2015-01-05 Bernd Edlinger Enable experimental TSAN support for Ada. * tsan.c (instrument_expr): Handle VIEW_CONVERT_EXPR. From-SVN: r219197 --- gcc/ChangeLog | 5 +++++ gcc/tsan.c | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2ba1d2bdcf6..923cea3f0ff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-01-05 Bernd Edlinger + + Enable experimental TSAN support for Ada. + * tsan.c (instrument_expr): Handle VIEW_CONVERT_EXPR. + 2015-01-05 Jakub Jelinek PR tree-optimization/64494 diff --git a/gcc/tsan.c b/gcc/tsan.c index a5e8133bc3c..1bc146f198d 100644 --- a/gcc/tsan.c +++ b/gcc/tsan.c @@ -212,6 +212,17 @@ instrument_expr (gimple_stmt_iterator gsi, tree expr, bool is_write) build_int_cst (TREE_TYPE (expr), bitpos / BITS_PER_UNIT)); expr_ptr = build_fold_addr_expr (expr); } + /* We can't call build_fold_addr_expr on a VIEW_CONVERT_EXPR. + This can occur in Ada. */ + else if (TREE_CODE (expr) == VIEW_CONVERT_EXPR) + { + align = get_object_alignment (expr); + if (align < BITS_PER_UNIT) + return false; + expr = TREE_OPERAND (expr, 0); + gcc_checking_assert (is_gimple_addressable (expr)); + expr_ptr = build_fold_addr_expr (unshare_expr (expr)); + } else { align = get_object_alignment (expr); -- 2.30.2