[Bug c++/80763] [7/8 Regression] -O3 causes error: inline clone in same comdat group list

2018-01-09 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80763

--- Comment #13 from Jan Hubicka  ---
Author: hubicka
Date: Tue Jan  9 08:22:28 2018
New Revision: 256369

URL: https://gcc.gnu.org/viewcvs?rev=256369=gcc=rev
Log:

PR ipa/80763
* ipa-comdats.c (set_comdat_group): Only set comdat group of real
symbols; not inline clones.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/ipa-comdats.c

[Bug c++/80763] [7/8 Regression] -O3 causes error: inline clone in same comdat group list

2018-01-08 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80763

Jan Hubicka  changed:

   What|Removed |Added

   Assignee|marxin at gcc dot gnu.org  |hubicka at gcc dot 
gnu.org

--- Comment #12 from Jan Hubicka  ---
Sorry, attached incorrect path.
Index: ipa-comdats.c
===
--- ipa-comdats.c   (revision 256232)
+++ ipa-comdats.c   (working copy)
@@ -211,8 +211,11 @@ set_comdat_group (symtab_node *symbol,
   symtab_node *head = (symtab_node *)head_p;

   gcc_assert (!symbol->get_comdat_group ());
-  symbol->set_comdat_group (head->get_comdat_group ());
-  symbol->add_to_same_comdat_group (head);
+  if (symbol->real_symbol_p ())
+{
+  symbol->set_comdat_group (head->get_comdat_group ());
+  symbol->add_to_same_comdat_group (head);
+}
   return false;
 }

[Bug c++/80763] [7/8 Regression] -O3 causes error: inline clone in same comdat group list

2018-01-08 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80763

Jan Hubicka  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

--- Comment #11 from Jan Hubicka  ---
The reduced testcase does not reproduce anymore so I assumed this to be fixed,
sorry for that.  The problem is that comdats pass privatizes inlined thunk.
This is bid odd side case of for_symbol_thunk_and_aliases - honestly i am not
sure if it should consider inlined thunk to be thunk anymore, but given the
name it probably should.

Honza

Index: ipa-comdats.c
===
--- ipa-comdats.c   (revision 256232)
+++ ipa-comdats.c   (working copy)
@@ -341,7 +341,7 @@ ipa_comdats (void)
   if (!symbol->get_comdat_group ()
  && !symbol->alias
  && (!(fun = dyn_cast  (symbol))
- || !fun->thunk.thunk_p)
+ || (!fun->thunk.thunk_p && !fun->global.inlined_to))
  && symbol->real_symbol_p ())
{
  tree *val = map.get (symbol);

[Bug c++/80763] [7/8 Regression] -O3 causes error: inline clone in same comdat group list

2018-01-06 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80763

David Binderman  changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu.org

--- Comment #10 from David Binderman  ---
(In reply to David Binderman from comment #9)
> Broken for over four months now.

Still broken. Regression from 8.0

Since hubicka hasn't fixed it in six months, perhaps it is
time to allow someone else to have a go ?

I'd be happy to help with any testing of any speculative patch.

[Bug c++/80763] [7/8 Regression] -O3 causes error: inline clone in same comdat group list

2017-09-21 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80763

--- Comment #9 from David Binderman  ---
(In reply to David Binderman from comment #8)
> (In reply to David Binderman from comment #7)
> > Still seems to be broken, over a month later.
> 
> Still broken, a couple of months even later ...

Broken for over four months now.

[Bug c++/80763] [7/8 Regression] -O3 causes error: inline clone in same comdat group list

2017-08-18 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80763

--- Comment #8 from David Binderman  ---
(In reply to David Binderman from comment #7)
> Still seems to be broken, over a month later.

Still broken, a couple of months even later ...

[Bug c++/80763] [7/8 Regression] -O3 causes error: inline clone in same comdat group list

2017-08-16 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80763

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|7.2 |7.3

[Bug c++/80763] [7/8 Regression] -O3 causes error: inline clone in same comdat group list

2017-08-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80763

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|7.2 |7.3

--- Comment #11 from Richard Biener  ---
GCC 7.2 is being released, adjusting target milestone.

--- Comment #12 from Richard Biener  ---
GCC 7.2 is being released, adjusting target milestone.

[Bug c++/80763] [7/8 Regression] -O3 causes error: inline clone in same comdat group list

2017-08-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80763

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|7.2 |7.3

--- Comment #11 from Richard Biener  ---
GCC 7.2 is being released, adjusting target milestone.

--- Comment #12 from Richard Biener  ---
GCC 7.2 is being released, adjusting target milestone.

[Bug c++/80763] [7/8 Regression] -O3 causes error: inline clone in same comdat group list

2017-08-14 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80763

--- Comment #10 from Martin Liška  ---
Hm, the function clone_inlined_nodes contains logic that does:

   │246 e->callee->remove_from_same_comdat_group ();

but only when duplicate == false. Will be more complex to handle, please take a
look Honza.

[Bug c++/80763] [7/8 Regression] -O3 causes error: inline clone in same comdat group list

2017-08-14 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80763

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #8 from Martin Liška  ---
Created attachment 41987
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41987=edit
Patch candidate

I wrongly pasted 2 patches to a different PR.

Adding patch candidate that changes cgraph_node::verify_node that verifies
global.inlined_to && same_comdat_group. It believe proper fix is to verify that
node should live in a same comdat group (if belongs to any).

Honza's reply:

OK, so now the tests passes when inline clone is either in no comdat group list
(even if function inlined to is in one) or if the comdat groups are the same. 
Does it fail when we test that comdats groups are always the same?  It seems
iffy to allow silently both.  I guess both variants are fine, but lets pick one
of them. Perhaps we want only to remove node from comdat group list while
inlining it.

My reply:
I'm going to test it whether more strict test will survive.
Honza

--- Comment #9 from Martin Liška  ---

So having:

  if (global.inlined_to
  && get_comdat_group () != global.inlined_to->get_comdat_group ())
{
  error ("inline clone in a different comdat group list");
  error_found = true;
}

fails in situation like this:

namespace {
class a
{
public:
  a ();
};
class b : a
{
};
}
namespace c {
class e : b
{
};
d () { e (); }
}

ice.i:12:7: error: inline clone in a different comdat group list
 class e : b
   ^
_ZN12_GLOBAL__N_11bC2Ev/1 ({anonymous}::b::b()) @0x2b14a0ce4170
  Type: function definition analyzed
  Visibility: prevailing_def_ironly artificial
  References: 
  Referring: 
  Function {anonymous}::b::b()/1 is inline copy in c::e::e()/4
  Availability: local
  First run: 0
  Function flags: body local
  Called by: c::e::e()/4 (inlined) (1.00 per call) (can throw external) 
  Calls: {anonymous}::a::a()/7 (1.00 per call) (can throw external) 
during GIMPLE pass: einline
ice.i:12:7: internal compiler error: verify_cgraph_node failed
0x979eb3 cgraph_node::verify_node()
../../gcc/cgraph.c:3537
0x96e15c symtab_node::verify()
../../gcc/symtab.c:1204
0xe241b9 expand_call_inline
../../gcc/tree-inline.c:4581
0xe27184 gimple_expand_calls_inline
../../gcc/tree-inline.c:4954
0xe27184 optimize_inline_calls(tree_node*)
../../gcc/tree-inline.c:5094
0x1556a39 early_inliner(function*)
../../gcc/ipa-inline.c:2727

So do you prefer changing the comdat group when inlining or original version of
verifier is preferred?

Honza:


I would say that we have loops walking all symbols in given comdat group that
are not
really expecting to trip over inline clones, so it may be easier to
consistently take
inline clones out of the comdat group rather than consistently to put them in.

Honza

[Bug c++/80763] [7/8 Regression] -O3 causes error: inline clone in same comdat group list

2017-08-14 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80763

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #8 from Martin Liška  ---
Created attachment 41987
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41987=edit
Patch candidate

I wrongly pasted 2 patches to a different PR.

Adding patch candidate that changes cgraph_node::verify_node that verifies
global.inlined_to && same_comdat_group. It believe proper fix is to verify that
node should live in a same comdat group (if belongs to any).

Honza's reply:

OK, so now the tests passes when inline clone is either in no comdat group list
(even if function inlined to is in one) or if the comdat groups are the same. 
Does it fail when we test that comdats groups are always the same?  It seems
iffy to allow silently both.  I guess both variants are fine, but lets pick one
of them. Perhaps we want only to remove node from comdat group list while
inlining it.

My reply:
I'm going to test it whether more strict test will survive.
Honza

[Bug c++/80763] [7/8 Regression] -O3 causes error: inline clone in same comdat group list

2017-06-25 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80763

--- Comment #7 from David Binderman  ---
Still seems to be broken, over a month later.

[Bug c++/80763] [7/8 Regression] -O3 causes error: inline clone in same comdat group list

2017-05-16 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80763

--- Comment #6 from H.J. Lu  ---
This is introduced by r236012 with a different ICE:

pr80763.cc:27:14: internal compiler error: in inline_small_functions, at
ipa-inline.c:1881
 void n::o() {}
  ^
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

r236271 changed ICE to

pr80763.cc:27:14: error: inline clone in same comdat group list
 void n::o() {}
  ^
_ZThn8_N1n1fE.artificial_thunk.2/42 () @0x7f2be1015e60
  Type: function definition analyzed
  Visibility: comdat_group:_ZN1iI1lE1dEjj artificial
  Same comdat group as: _ZN1iI1lE1dEjj/25
  References: 
  Referring: 
  Function /42 is inline copy in unsigned int i::d(unsigned int,
unsigned int) [with e = l]/25
  Availability: local
  First run: 0
  Function flags: local nonfreeing_fn
  Thunk fixed offset -8 virtual value 0 has virtual offset 0)
  Called by: _ZN1iI1lE1dEjj.part.0/35 (speculative) (inlined) (0.31 per call)
(can throw external) 
  Calls: _ZN1n1fE.constprop.1/41 (call_stmt_cannot_inline_p) (0.31 per
call) 
pr80763.cc:27:14: internal compiler error: verify_cgraph_node failed
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
gnu-ivb-1:pts/1[63]> ./gcc-test-run 236267
Testing /export/gnu/import/git/gcc-regression/master/236267/usr/bin/gcc:
pr80763.cc:27:14: internal compiler error: in inline_small_functions, at
ipa-inline.c:1881
 void n::o() {}
  ^
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

[Bug c++/80763] [7/8 Regression] -O3 causes error: inline clone in same comdat group list

2017-05-16 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80763

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2
 Status|UNCONFIRMED |NEW
  Known to work||6.3.0
   Keywords||ice-checking
   Last reconfirmed||2017-05-16
 CC||hubicka at gcc dot gnu.org
 Ever confirmed|0   |1
Summary|-O3 causes error: inline|[7/8 Regression] -O3 causes
   |clone in same comdat group  |error: inline clone in same
   |list|comdat group list
   Target Milestone|--- |7.2
  Known to fail||7.1.0

--- Comment #5 from Richard Biener  ---
Confirmed.  Fails on the branch with -fchecking.