* trans-mem.c (finish_tm_clone_pairs_1): Never create cgraph_nodes
        here; allow them to vanish out from under.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/transactional-memory@180637 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog.tm |    3 +++
 gcc/varasm.c     |    6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/gcc/ChangeLog.tm b/gcc/ChangeLog.tm
index dfdf9ee..49ad060 100644
--- a/gcc/ChangeLog.tm
+++ b/gcc/ChangeLog.tm
@@ -1,5 +1,8 @@
 2011-10-28  Richard Henderson  <r...@redhat.com>
 
+       * trans-mem.c (finish_tm_clone_pairs_1): Never create cgraph_nodes
+       here; allow them to vanish out from under.
+
        * trans-mem.c (ipa_tm_mayenterirr_function): Recurse for aliases.
        (ipa_tm_mark_needed_node): Split out of callback_mark_needed.
        (ipa_tm_create_version_alias): Rename from callback_mark_needed.
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 65bef8a..9771c80 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -5910,7 +5910,7 @@ finish_tm_clone_pairs_1 (void **slot, void *info 
ATTRIBUTE_UNUSED)
   tree src = map->base.from;
   tree dst = map->to;
   struct cgraph_node *src_n = cgraph_get_node (src);
-  struct cgraph_node *dst_n = cgraph_get_create_node (dst);
+  struct cgraph_node *dst_n = cgraph_get_node (dst);
 
   /* The function ipa_tm_create_version() marks the clone as needed if
      the original function was needed.  But we also mark the clone as
@@ -5918,12 +5918,12 @@ finish_tm_clone_pairs_1 (void **slot, void *info 
ATTRIBUTE_UNUSED)
      TM_GETTMCLONE.  If neither of these are true, we didn't generate
      a clone, and we didn't call it indirectly... no sense keeping it
      in the clone table.  */
-  if (!dst_n->needed)
+  if (!dst_n || !dst_n->needed)
     return 1;
 
   /* This covers the case where we have optimized the original
      function away, and only access the transactional clone.  */
-  if (!src_n->needed)
+  if (!src_n || !src_n->needed)
     return 1;
 
   if (!*switched)
-- 
1.7.6.4

Reply via email to