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]

Re: Eliminate write-only variables


> 
> Unfortunately, this commit has caused the following ICE for me when
> LTO building 471.omnetpp from SPEC 2006 or Firefox (but not libxul,
> something that gets built earlier):
> 
> lto1: internal compiler error: in gimple_get_virt_method_for_vtable,
> at gimple-fold.c:3276
> 0x7437a3 gimple_get_virt_method_for_vtable(long, tree_node*, unsigned
> long, bool*)  
>         /home/mjambor/gcc/bisect/src/gcc/gimple-fold.c:3276  
> 0x743993 gimple_get_virt_method_for_binfo(long, tree_node*, bool*)
>         /home/mjambor/gcc/bisect/src/gcc/gimple-fold.c:3377  
> 0x7913f2 possible_polymorphic_call_targets(tree_node*, long,
> ipa_polymorphic_call_context, bool*, void**, int*)  
>         /home/mjambor/gcc/bisect/src/gcc/ipa-devirt.c:1697  
> 0x7b73a9 possible_polymorphic_call_targets  
>         /home/mjambor/gcc/bisect/src/gcc/ipa-utils.h:121  
> 0x7b73a9 walk_polymorphic_call_targets  
>         /home/mjambor/gcc/bisect/src/gcc/ipa.c:177  
> 0x7b73a9 symtab_remove_unreachable_nodes(bool, _IO_FILE*)  
>         /home/mjambor/gcc/bisect/src/gcc/ipa.c:407  
> 0x86bf47 execute_todo  
>         /home/mjambor/gcc/bisect/src/gcc/passes.c:1843  
> Please submit a full bug report...
>  
> I compile omnetpp with -Ofast -g -flto=8 -fwhole-program
> -funroll-loops -fpeel-loops -march=native -mtune=native
> 
> I'm afraid I won't be able to prepare a more reduced testcase very
> soon.

Actually I think where is a problem: when the variable is completely dead
(that is no writes, reads and address taken), we still set the writeonly
flag and clear DECL_INITIAL.  This may happen for vtables still in use
by the type based devirt machinery. The following patch should fix it.

Bootstrapped/regtested and comitted to mainline. 
It also fixes the debug output issue you pointed out.

Index: ipa.c
===================================================================
--- ipa.c	(revision 210653)
+++ ipa.c	(working copy)
@@ -730,7 +730,7 @@ ipa_discover_readonly_nonaddressable_var
 	if (!address_taken)
 	  {
 	    if (TREE_ADDRESSABLE (vnode->decl) && dump_file)
-	      fprintf (dump_file, " %s (addressable)", vnode->name ());
+	      fprintf (dump_file, " %s (non-addressable)", vnode->name ());
 	    varpool_for_node_and_aliases (vnode, clear_addressable_bit, NULL, true);
 	  }
 	if (!address_taken && !written
@@ -743,7 +743,7 @@ ipa_discover_readonly_nonaddressable_var
 	      fprintf (dump_file, " %s (read-only)", vnode->name ());
 	    varpool_for_node_and_aliases (vnode, set_readonly_bit, NULL, true);
 	  }
-	if (!vnode->writeonly && !read && !address_taken)
+	if (!vnode->writeonly && !read && !address_taken && written)
 	  {
 	    if (dump_file)
 	      fprintf (dump_file, " %s (write-only)", vnode->name ());


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