===================================================================
@@ -0,0 +1,14 @@
+// { dg-do compile }
+// { dg-options "-fgnu-tm -O" }
+
+static int asdf __attribute__ ((__weakref__("funky")));
+
+class Building
+{
+public:
+ __attribute__((transaction_safe)) ~Building(void);
+};
+
+Building::~Building()
+{
+}
===================================================================
@@ -4021,6 +4021,12 @@ ipa_tm_create_version (struct cgraph_nod
old_decl = old_node->decl;
new_decl = copy_node (old_decl);
+
+ tm_name = tm_mangle (old_decl);
+ SET_DECL_ASSEMBLER_NAME (new_decl, get_identifier (tm_name));
+ SET_DECL_RTL (new_decl, NULL);
+ free (tm_name);
+
new_node = cgraph_copy_node_for_versioning (old_node, new_decl, NULL);
get_cg_data (old_node)->clone = new_node;
@@ -4031,11 +4037,6 @@ ipa_tm_create_version (struct cgraph_nod
bits in cgraph to calculate all this. */
DECL_IS_TM_CLONE (new_decl) = 1;
- tm_name = tm_mangle (old_decl);
- SET_DECL_ASSEMBLER_NAME (new_decl, get_identifier (tm_name));
- SET_DECL_RTL (new_decl, NULL);
- free (tm_name);
-
record_tm_clone_pair (old_decl, new_decl);
cgraph_call_function_insertion_hooks (new_node);