Patchwork Fix write_symbol testsuite ICE

login
register
mail settings
Submitter Jan Hubicka
Date July 10, 2010, 12:18 a.m.
Message ID <20100710001844.GK9621@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/58446/
State New
Headers show

Comments

Jan Hubicka - July 10, 2010, 12:18 a.m.
Hi,
this patch fixes the ICE while streaming out alias nodes.  It is all somewhat ugly,
since some aliases have varpool/cgraph nodes while others doesn't depending on
if they are or are not used in code...

Bootstrapped/regtested x86_64-linux, comitted as obvious.

Honza

2010-07-09  Jan Hubicka  <jh@suse.cz>

	* lto-streamer-out.c (produce_symtab): Do not write alias cgraph/varpool
	nodes.
Hans-Peter Nilsson - July 11, 2010, 1:03 a.m.
On Sat, 10 Jul 2010, Jan Hubicka wrote:

> Hi,
> this patch fixes the ICE while streaming out alias nodes.  It is all somewhat ugly,
> since some aliases have varpool/cgraph nodes while others doesn't depending on
> if they are or are not used in code...
>
> Bootstrapped/regtested x86_64-linux, comitted as obvious.
>
> Honza
>
> 2010-07-09  Jan Hubicka  <jh@suse.cz>
>
> 	* lto-streamer-out.c (produce_symtab): Do not write alias cgraph/varpool
> 	nodes.

Looks like this fixed PR44845, regarding
gcc.c-torture/compile/20011119-2.c.

>
> Index: lto-streamer-out.c
> ===================================================================
> --- lto-streamer-out.c	(revision 161956)
> +++ lto-streamer-out.c	(working copy)
> @@ -2399,6 +2399,8 @@ produce_symtab (struct output_block *ob,
>    for (i = 0; i < lto_cgraph_encoder_size (encoder); i++)
>      {
>        node = lto_cgraph_encoder_deref (encoder, i);
> +      if (node->alias)
> +	continue;
>        write_symbol (cache, &stream, node->decl, seen, false);
>        for (alias = node->same_body; alias; alias = alias->next)
>          write_symbol (cache, &stream, alias->decl, seen, true);
> @@ -2408,6 +2410,8 @@ produce_symtab (struct output_block *ob,
>    for (i = 0; i < lto_varpool_encoder_size (varpool_encoder); i++)
>      {
>        vnode = lto_varpool_encoder_deref (varpool_encoder, i);
> +      if (vnode->alias)
> +	continue;
>        write_symbol (cache, &stream, vnode->decl, seen, false);
>        for (valias = vnode->extra_name; valias; valias = valias->next)
>          write_symbol (cache, &stream, valias->decl, seen, true);
>

Patch

Index: lto-streamer-out.c
===================================================================
--- lto-streamer-out.c	(revision 161956)
+++ lto-streamer-out.c	(working copy)
@@ -2399,6 +2399,8 @@  produce_symtab (struct output_block *ob,
   for (i = 0; i < lto_cgraph_encoder_size (encoder); i++)
     {
       node = lto_cgraph_encoder_deref (encoder, i);
+      if (node->alias)
+	continue;
       write_symbol (cache, &stream, node->decl, seen, false);
       for (alias = node->same_body; alias; alias = alias->next)
         write_symbol (cache, &stream, alias->decl, seen, true);
@@ -2408,6 +2410,8 @@  produce_symtab (struct output_block *ob,
   for (i = 0; i < lto_varpool_encoder_size (varpool_encoder); i++)
     {
       vnode = lto_varpool_encoder_deref (varpool_encoder, i);
+      if (vnode->alias)
+	continue;
       write_symbol (cache, &stream, vnode->decl, seen, false);
       for (valias = vnode->extra_name; valias; valias = valias->next)
         write_symbol (cache, &stream, valias->decl, seen, true);