===================================================================
@@ -278,8 +278,8 @@ extern void *_ITM_getTMCloneSafe (void *
extern void _ITM_registerTMCloneTable (void *, size_t);
extern void _ITM_deregisterTMCloneTable (void *);
-extern void *_ITM_cxa_allocate_exception (size_t);
-extern void _ITM_cxa_throw (void *obj, void *tinfo, void *dest);
+extern void *_ITM_cxa_allocate_exception (size_t) ITM_PURE;
+extern void _ITM_cxa_throw (void *obj, void *tinfo, void *dest) ITM_PURE;
extern void *_ITM_cxa_begin_catch (void *exc_ptr);
extern void _ITM_cxa_end_catch (void);
extern void _ITM_commitTransactionEH(void *exc_ptr) ITM_REGPARM;
===================================================================
@@ -0,0 +1,8 @@
+// { dg-do compile }
+// { dg-options "-fgnu-tm" }
+
+void foo(){
+ __transaction {
+ throw 5;
+ }
+}
===================================================================
@@ -586,6 +586,7 @@ do_allocate_exception (tree type)
if (!get_global_value_if_present (fn2, &fn2))
fn2 = declare_nothrow_library_fn (fn2, ptr_type_node,
size_type_node);
+ apply_tm_attr (fn2, get_identifier ("transaction_pure"));
record_tm_replacement (fn, fn2);
}
}
@@ -729,6 +730,7 @@ build_throw (tree exp)
tree fn2 = get_identifier ("_ITM_cxa_throw");
if (!get_global_value_if_present (fn2, &fn2))
fn2 = push_throw_library_fn (fn2, tmp);
+ apply_tm_attr (fn2, get_identifier ("transaction_pure"));
record_tm_replacement (fn, fn2);
}
}