* [Bug middle-end/51929] [4.7 Regression] ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone
2012-01-21 11:34 [Bug middle-end/51929] New: ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone --param ipa-cp-eval-threshold=0 --param max-inline-insns-single=1 zsojka at seznam dot cz
@ 2012-02-05 15:15 ` zsojka at seznam dot cz
2012-02-06 12:37 ` rguenth at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: zsojka at seznam dot cz @ 2012-02-05 15:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51929
--- Comment #1 from Zdenek Sojka <zsojka at seznam dot cz> 2012-02-05 15:15:07 UTC ---
Created attachment 26575
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26575
autoreduced testcase
Probably the same problem.
$ gcc -O -fno-guess-branch-probability -fipa-cp -fipa-cp-clone
--param=max-inline-insns-single=25 testcase-min4.ii
testcase-min4.ii:142:1: error: edge points to wrong declaration:
...
References: var:std::string str_01 (addr) fn:<built-in>/16 (addr)
Refering this function:
testcase-min4.ii:142:1: internal compiler error: verify_cgraph_node failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Tested revisions:
r183883 - crash
4.6 r180325 - OK
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/51929] [4.7 Regression] ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone
2012-01-21 11:34 [Bug middle-end/51929] New: ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone --param ipa-cp-eval-threshold=0 --param max-inline-insns-single=1 zsojka at seznam dot cz
2012-02-05 15:15 ` [Bug middle-end/51929] [4.7 Regression] ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone zsojka at seznam dot cz
@ 2012-02-06 12:37 ` rguenth at gcc dot gnu.org
2012-02-07 15:40 ` rguenth at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-06 12:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51929
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org
Target Milestone|--- |4.7.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/51929] [4.7 Regression] ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone
2012-01-21 11:34 [Bug middle-end/51929] New: ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone --param ipa-cp-eval-threshold=0 --param max-inline-insns-single=1 zsojka at seznam dot cz
2012-02-05 15:15 ` [Bug middle-end/51929] [4.7 Regression] ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone zsojka at seznam dot cz
2012-02-06 12:37 ` rguenth at gcc dot gnu.org
@ 2012-02-07 15:40 ` rguenth at gcc dot gnu.org
2012-02-09 16:52 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-07 15:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51929
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-checking
Priority|P3 |P1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-02-07
Ever Confirmed|0 |1
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-07 15:40:21 UTC ---
Confirmed.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/51929] [4.7 Regression] ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone
2012-01-21 11:34 [Bug middle-end/51929] New: ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone --param ipa-cp-eval-threshold=0 --param max-inline-insns-single=1 zsojka at seznam dot cz
` (2 preceding siblings ...)
2012-02-07 15:40 ` rguenth at gcc dot gnu.org
@ 2012-02-09 16:52 ` jakub at gcc dot gnu.org
2012-02-09 16:56 ` zsojka at seznam dot cz
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-02-09 16:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51929
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-09 16:51:25 UTC ---
The first testcase IMNSHO isn't a regression, because it ICEs since the
ipa-cp-eval-threshold param has been added. The other testcase is a
regression, started ICEing with the same commit:
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176424
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/51929] [4.7 Regression] ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone
2012-01-21 11:34 [Bug middle-end/51929] New: ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone --param ipa-cp-eval-threshold=0 --param max-inline-insns-single=1 zsojka at seznam dot cz
` (3 preceding siblings ...)
2012-02-09 16:52 ` jakub at gcc dot gnu.org
@ 2012-02-09 16:56 ` zsojka at seznam dot cz
2012-02-09 18:43 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: zsojka at seznam dot cz @ 2012-02-09 16:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51929
--- Comment #4 from Zdenek Sojka <zsojka at seznam dot cz> 2012-02-09 16:55:28 UTC ---
Yes, I marked this PR as a regression after adding the second testcase, along
with modifying the summary.
The way it behaves in 4.6 is described in the "Tested revisions" paragraph, but
yes, I should have been more clear, sorry.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/51929] [4.7 Regression] ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone
2012-01-21 11:34 [Bug middle-end/51929] New: ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone --param ipa-cp-eval-threshold=0 --param max-inline-insns-single=1 zsojka at seznam dot cz
` (4 preceding siblings ...)
2012-02-09 16:56 ` zsojka at seznam dot cz
@ 2012-02-09 18:43 ` jakub at gcc dot gnu.org
2012-02-10 10:33 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-02-09 18:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51929
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-09 18:43:01 UTC ---
Reduced testcase:
// { dg-do compile }
// { dg-options "-O -fno-guess-branch-probability -fipa-cp -fipa-cp-clone
--param=max-inline-insns-single=25" }
struct A
{
A (A, unsigned);
A (const char *);
~A () { a1 (a4 ()); }
void a1 (int);
unsigned a2 ();
char *a3 ();
int a4 ();
};
template <typename T>
struct B
{
A b;
B (A x, int y = 1) : b (x.a3 (), x.a2 ()) { if (y & 1) b.a2 (); }
};
extern template struct B <char>;
A a1 ("foo"), a2 ("bar");
B<char> b1 (a1), b2 (a2, 8);
void
foo ()
{
A a3 ("baz");
B<char> b3 (a1), b4 (a3);
}
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/51929] [4.7 Regression] ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone
2012-01-21 11:34 [Bug middle-end/51929] New: ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone --param ipa-cp-eval-threshold=0 --param max-inline-insns-single=1 zsojka at seznam dot cz
` (5 preceding siblings ...)
2012-02-09 18:43 ` jakub at gcc dot gnu.org
@ 2012-02-10 10:33 ` jakub at gcc dot gnu.org
2012-02-10 11:28 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-02-10 10:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51929
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-10 10:33:33 UTC ---
This is related to same body aliases. The verification fails because IPA-CP
decides to cgraph_redirect_edge_callee a call_stmt that calls a same_body_alias
of B<char>::B(A, int) (__comp_ctor) to a clone of not that node (i.e. not the
same_body_alias), but of its ->thunk.alias (i.e. the alias with the actual body
of the ctor, __base_ctor). I don't find anything wrong on that, so I've tried
to adjust just the verification:
- function. This ping-pong has to go, eventaully. */
+ function. This ping-pong has to go, eventually. */
&& (node != cgraph_function_or_thunk_node (e->callee, NULL))
- && !clone_of_p (node, e->callee))
+ && !clone_of_p (node, e->callee)
+ /* If decl is a same body alias of some other decl, allow e->callee to
be
+ a clone of a clone of that other decl too. */
+ && (!node->same_body_alias
+ || !clone_of_p (cgraph_get_node (node->thunk.alias), e->callee)))
but unfortunately it just cures one of the two error: edge points to wrong
declaration: errors.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/51929] [4.7 Regression] ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone
2012-01-21 11:34 [Bug middle-end/51929] New: ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone --param ipa-cp-eval-threshold=0 --param max-inline-insns-single=1 zsojka at seznam dot cz
` (6 preceding siblings ...)
2012-02-10 10:33 ` jakub at gcc dot gnu.org
@ 2012-02-10 11:28 ` jakub at gcc dot gnu.org
2012-02-10 11:49 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-02-10 11:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51929
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-10 11:27:39 UTC ---
What happens is that cgraph_materialize_clone on the _ZN1BIcEC2E1Ai.constprop.1
clone performs:
2451 if (!node->clone_of->analyzed && !node->clone_of->clones)
2452 {
2453 cgraph_release_function_body (node->clone_of);
2454 cgraph_node_remove_callees (node->clone_of);
2455 ipa_remove_all_references (&node->clone_of->ref_list);
2456 }
2457 node->clone_of = NULL;
where node->clone_of is _ZN1BIcEC2E1Ai, i.e. the __base_ctor and so the
verification fails.
Even before this cgraph_remove_unreachable_nodes marks the _ZN1BIcEC1E1Ai (i.e.
__comp_ctor to which the call_stmts still refer) as unreachable and calls
ipa_remove_all_references on it, which means I don't see a way how we could get
from the _ZN1BIcEC2E1Ai to _ZN1BIcEC1E1Ai node anymore.
Honza?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/51929] [4.7 Regression] ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone
2012-01-21 11:34 [Bug middle-end/51929] New: ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone --param ipa-cp-eval-threshold=0 --param max-inline-insns-single=1 zsojka at seznam dot cz
` (7 preceding siblings ...)
2012-02-10 11:28 ` jakub at gcc dot gnu.org
@ 2012-02-10 11:49 ` jakub at gcc dot gnu.org
2012-02-10 12:32 ` hubicka at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-02-10 11:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51929
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |jakub at gcc dot gnu.org
|gnu.org |
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-10 11:49:18 UTC ---
Created attachment 26638
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26638
gcc47-pr51929.patch
Actually, it is handled afterwards using the former_clone_of check.
If that one is adjusted too, this compiles fine. Does this look correct?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/51929] [4.7 Regression] ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone
2012-01-21 11:34 [Bug middle-end/51929] New: ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone --param ipa-cp-eval-threshold=0 --param max-inline-insns-single=1 zsojka at seznam dot cz
` (8 preceding siblings ...)
2012-02-10 11:49 ` jakub at gcc dot gnu.org
@ 2012-02-10 12:32 ` hubicka at gcc dot gnu.org
2012-02-16 7:34 ` jakub at gcc dot gnu.org
2012-02-16 7:47 ` jakub at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: hubicka at gcc dot gnu.org @ 2012-02-10 12:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51929
--- Comment #9 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-02-10 12:31:24 UTC ---
Yes, it looks OK to me. Thanks!
Perhaps we will eventually need to give up on this sanity check as the
transformations we do to callgraph gets more general...
Honza
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/51929] [4.7 Regression] ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone
2012-01-21 11:34 [Bug middle-end/51929] New: ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone --param ipa-cp-eval-threshold=0 --param max-inline-insns-single=1 zsojka at seznam dot cz
` (9 preceding siblings ...)
2012-02-10 12:32 ` hubicka at gcc dot gnu.org
@ 2012-02-16 7:34 ` jakub at gcc dot gnu.org
2012-02-16 7:47 ` jakub at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-02-16 7:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51929
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-16 07:27:28 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug middle-end/51929] [4.7 Regression] ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone
2012-01-21 11:34 [Bug middle-end/51929] New: ICE: verify_cgraph_node failed with -O2 -fno-guess-branch-probability -fipa-cp-clone --param ipa-cp-eval-threshold=0 --param max-inline-insns-single=1 zsojka at seznam dot cz
` (10 preceding siblings ...)
2012-02-16 7:34 ` jakub at gcc dot gnu.org
@ 2012-02-16 7:47 ` jakub at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-02-16 7:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51929
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-16 07:26:08 UTC ---
Author: jakub
Date: Thu Feb 16 07:25:58 2012
New Revision: 184301
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184301
Log:
PR middle-end/51929
* cgraphunit.c (verify_edge_corresponds_to_fndecl): If node is
a same_body_alias, also test whether e->callee isn't a former
or current clone of the decl this is a same body alias of.
* g++.dg/ipa/pr51929.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/ipa/pr51929.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cgraphunit.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 13+ messages in thread