aboutsummaryrefslogtreecommitdiff
path: root/gcc/trans-mem.c
diff options
context:
space:
mode:
authorTorvald Riegel <triegel@redhat.com>2011-11-21 22:29:31 +0000
committerTorvald Riegel <torvald@gcc.gnu.org>2011-11-21 22:29:31 +0000
commitcd6baa162d29845341b74e61c36a61614a36b204 (patch)
tree34a48a93c32d86a3671f6aa53cd162dbd27c0c21 /gcc/trans-mem.c
parent1e159409fcacfdfcb7046c3d870ee60d9e4131e8 (diff)
downloadgcc-cd6baa162d29845341b74e61c36a61614a36b204.zip
gcc-cd6baa162d29845341b74e61c36a61614a36b204.tar.gz
gcc-cd6baa162d29845341b74e61c36a61614a36b204.tar.bz2
PR47747: Fix error messages for calls to unsafe virtual functions.
gcc/ * trans-mem.c (diagnose_tm_1): Print an expression instead of a declaration in error messages for indirect calls. testsuite/ g++.dg/tm/pr47747.C: New test. From-SVN: r181602
Diffstat (limited to 'gcc/trans-mem.c')
-rw-r--r--gcc/trans-mem.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 3c0bd60..347183b 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -659,13 +659,27 @@ diagnose_tm_1 (gimple_stmt_iterator *gsi, bool *handled_ops_p,
if (TREE_CODE (fn) == ADDR_EXPR)
fn = TREE_OPERAND (fn, 0);
if (d->block_flags & DIAG_TM_SAFE)
- error_at (gimple_location (stmt),
- "unsafe function call %qD within "
- "atomic transaction", fn);
+ {
+ if (direct_call_p)
+ error_at (gimple_location (stmt),
+ "unsafe function call %qD within "
+ "atomic transaction", fn);
+ else
+ error_at (gimple_location (stmt),
+ "unsafe function call %qE within "
+ "atomic transaction", fn);
+ }
else
- error_at (gimple_location (stmt),
- "unsafe function call %qD within "
- "%<transaction_safe%> function", fn);
+ {
+ if (direct_call_p)
+ error_at (gimple_location (stmt),
+ "unsafe function call %qD within "
+ "%<transaction_safe%> function", fn);
+ else
+ error_at (gimple_location (stmt),
+ "unsafe function call %qE within "
+ "%<transaction_safe%> function", fn);
+ }
}
}
}