@@ -9817,9 +9817,11 @@ set_call_expr_flags (tree decl, int flags)
if (flags & ECF_LEAF)
DECL_ATTRIBUTES (decl) = tree_cons (get_identifier ("leaf"),
NULL, DECL_ATTRIBUTES (decl));
- if ((flags & ECF_TM_PURE) && flag_tm)
- DECL_ATTRIBUTES (decl) = tree_cons (get_identifier ("transaction_pure"),
- NULL, DECL_ATTRIBUTES (decl));
+
+ /* The "transaction_pure" attribute must be set on the function type, not
+ on the declaration. */
+ gcc_assert (!(flags & ECF_TM_PURE));
+
/* Looping const or pure is implied by noreturn.
There is currently no way to declare looping const or looping pure alone. */
gcc_assert (!(flags & ECF_LOOPING_CONST_OR_PURE)
@@ -10018,8 +10020,9 @@ build_common_builtin_nodes (void)
integer_type_node, NULL_TREE);
ecf_flags = ECF_PURE | ECF_NOTHROW | ECF_LEAF;
/* Only use TM_PURE if we we have TM language support. */
- if (builtin_decl_explicit_p (BUILT_IN_TM_LOAD_1))
- ecf_flags |= ECF_TM_PURE;
+ if (flag_tm && builtin_decl_explicit_p (BUILT_IN_TM_LOAD_1))
+ TYPE_ATTRIBUTES (ftype) = tree_cons (get_identifier ("transaction_pure"),
+ NULL, TYPE_ATTRIBUTES (ftype));
local_define_builtin ("__builtin_eh_pointer", ftype, BUILT_IN_EH_POINTER,
"__builtin_eh_pointer", ecf_flags);