This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[lto] Fix assertions when reading cgraph edges


This patch from Rafael fixes the checks we do when reading cgraph
edges.  We were erroneously checking that the callee had an
identical prevailing definition, when the check was intended to
be on the caller.

Tested on x86_64.


2008-11-17  Rafael Espindola  <espindola@google.com>

	* lto-cgraph.c (input_edge): Rename PREVAILING with
	PREVAILING_CALLEE.
	Add PREVAILING_CALLER.  Assert that caller->decl and its
	prevailing definition are the same.

Index: lto-cgraph.c
===================================================================
--- lto-cgraph.c	(revision 141904)
+++ lto-cgraph.c	(working copy)
@@ -585,7 +585,8 @@ input_edge (struct lto_input_block *ib, 
   unsigned int nest;
   cgraph_inline_failed_t inline_failed;
   unsigned HOST_WIDEST_INT flags;
-  tree prevailing;
+  tree prevailing_callee;
+  tree prevailing_caller;
   enum ld_plugin_symbol_resolution caller_resolution;
 
   LTO_DEBUG_TOKEN ("caller");
@@ -626,8 +627,11 @@ input_edge (struct lto_input_block *ib, 
       || caller_resolution == LDPR_PREEMPTED_IR)
       return;
 
-  /* Make sure the callee is the prevailing decl. */
-  prevailing = lto_symtab_prevailing_decl (callee->decl);
+
+  prevailing_callee = lto_symtab_prevailing_decl (callee->decl);
+
+  /* Make sure the caller is the prevailing decl. */
+  prevailing_caller = lto_symtab_prevailing_decl (caller->decl);
 
   /* FIXME lto: remove this once extern inline in handled in lgen. */
   if (caller_resolution != LDPR_PREVAILING_DEF
@@ -636,16 +640,16 @@ input_edge (struct lto_input_block *ib, 
       && caller_resolution != LDPR_PREEMPTED_IR)
     {
       /* If we have a extern inline, make sure it is the prevailing. */
-      gcc_assert (prevailing == callee->decl);
+      gcc_assert (prevailing_caller == caller->decl);
     }
 
-  if (prevailing != callee->decl)
+  if (prevailing_callee != callee->decl)
     {
       /* We cannot replace a clone! */
       gcc_assert (callee == cgraph_node (callee->decl));
 
 
-      callee = cgraph_node (prevailing);
+      callee = cgraph_node (prevailing_callee);
       gcc_assert (callee);
     }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]