http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45940
--- Comment #10 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2010-12-13
14:15:49 UTC ---
[offline rth notes]
In function_attribute_inlinable_p, if fndecl is tm_pure and
current_function_decl is tm_safe, deny the inlining.
This is because tm_pure is the only escape hatch we
have for "do not annotate this". E.g. you want to
add a call to printf for debugging, or there's some
data you know that shouldn't be part of the transaction.
The fix for this is to implement __tm_waiver. But you
know yourself how tricky getting just the transaction
blocks correct has been. Adding holes within the
region is... nasty. But probably required eventually.
In inline_forbidden_p_stmt, notice asms and prevent them from
being inlined if current_function_decl is tm_safe.
This will stop early inlining from breaking tm_safe
functions when dealing with e.g. system header files
that include inline asms.