[Bug c++/65277] [5 Regression] ice in get_untransformed_body with -O2

2015-03-02 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65277

--- Comment #4 from Jan Hubicka hubicka at gcc dot gnu.org ---
get_untransformed_body should turn itself into noop in !in_lto_p compilation as
all function bodies have DECL_RESULT. (it probably deserves comment, but that
way we check if the body was read)

Formatting is off:

  for (i = new_order_pos - 1; i = 0; i--)
{
  node = order[i];

  if (node-process)
{
 expanded_func_count++;
 if(node-tp_first_run)
   profiled_func_count++;

if (symtab-dump_file)
  fprintf (symtab-dump_file,
   Time profile order in expand_all_functions:%s:%d\n,
   node-asm_name (), node-tp_first_run);
  node-process = 0;
  node-expand ();
}
}

but actual code makes sense. Node in question is:
_ZTch0_v0_n40_N3Ent4ThisEv/7 (virtual Ent Ent::_ZTch0_v0_n40_N3Ent4ThisEv())
@0x76c5d620
  Type: function
  Body removed by symtab_remove_unreachable_nodes
  Visibility: externally_visible public weak comdat comdat_group:_ZN3Ent4ThisEv
one_only section:.text._ZN3Ent4ThisEv (implicit_section) virtual artificial
  Same comdat group as: _ZN3Ent4ThisEv/5
  References: 
  Referring: 
  Availability: not_available
  First run: 0
  Function flags: icf_merged
  Called by: 
  Calls: 

it was removed, so it is wrong that we try to output it.

The removal happens in ipa-icf and it is based on
cgraph_can_remove_if_no_direct_calls_p being wrong - if symbol is in comdat
group removing all direct calls to it may not make it removable if other
symbols hold it around... Will fix that.


[Bug c++/65277] [5 Regression] ice in get_untransformed_body with -O2

2015-03-02 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65277

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P1
 CC||hubicka at gcc dot gnu.org
   Target Milestone|--- |5.0
Summary|ice in  |[5 Regression] ice in
   |get_untransformed_body with |get_untransformed_body with
   |-O2 |-O2


[Bug c++/65277] [5 Regression] ice in get_untransformed_body with -O2

2015-03-02 Thread ktietz at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65277

Kai Tietz ktietz at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-03-02
 CC||ktietz at gcc dot gnu.org,
   ||maxim at trivialbugs dot com
 Ever confirmed|0   |1

--- Comment #1 from Kai Tietz ktietz at gcc dot gnu.org ---
Issue seems to be happend in expand_all_functions.  In prior versions we called
expand_function, but now we are calling directly expand ().  Expand () itself
makes use of function get_untransformed_body, which checks for in-LTO-mode,
which of course fails.
Anyway the most funny thing here is that this change is not mentioned in any
ChangeLog.  It is caused by r214422


[Bug c++/65277] [5 Regression] ice in get_untransformed_body with -O2

2015-03-02 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65277

Marek Polacek mpolacek at gcc dot gnu.org changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek mpolacek at gcc dot gnu.org ---
221040(In reply to Kai Tietz from comment #1)
 It is caused by r214422

No, I think this started with r221040.


[Bug c++/65277] [5 Regression] ice in get_untransformed_body with -O2

2015-03-02 Thread ktietz at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65277

--- Comment #3 from Kai Tietz ktietz at gcc dot gnu.org ---
(In reply to Marek Polacek from comment #2)
 221040(In reply to Kai Tietz from comment #1)
  It is caused by r214422
 
 No, I think this started with r221040.

Yes, it got shown with r221040.  Nevertheless code-change mentioned before
happend in r214256 (svn blame lied).  So I am testing right now:

Index: cgraphunit.c
===
--- cgraphunit.c(Revision 221103)
+++ cgraphunit.c(Arbeitskopie)
@@ -1847,7 +1847,8 @@ cgraph_node::expand (void)
   announce_function (decl);
   process = 0;
   gcc_assert (lowered);
-  get_untransformed_body ();
+  if (in_lto_p)
+get_untransformed_body ();

   /* Generate RTL for the body of DECL.  */