+2011-11-21 Torvald Riegel <triegel@redhat.com>
+
+ * trans-mem.c (diagnose_tm_1): Print an expression instead of a
+ declaration in error messages for indirect calls.
+
2011-11-21 David S. Miller <davem@davemloft.net>
* config/sparc/sparc.c (sparc_regmode_natural_size): New function
--- /dev/null
+// { dg-do compile }
+// { dg-options "-fgnu-tm -O" }
+
+class InputStream
+{
+ public:
+// __attribute__((transaction_safe))
+ virtual unsigned int readUint32 () = 0;
+};
+
+class Building
+{
+ public:
+ __attribute__((transaction_safe))
+ Building (InputStream *stream);
+};
+
+Building::Building (InputStream *stream)
+{
+ stream->readUint32 (); /* { dg-error "InputStream::readUint32" } */
+}
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);
+ }
}
}
}