Bug 46469 - [4.6 Regression] ICE: verify_cgraph_node failed: inline clone is needed at -O
Summary: [4.6 Regression] ICE: verify_cgraph_node failed: inline clone is needed at -O
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.6.0
: P1 normal
Target Milestone: 4.6.0
Assignee: Jan Hubicka
Keywords: ice-checking, ice-on-valid-code
Depends on:
Reported: 2010-11-13 22:38 UTC by Zdenek Sojka
Modified: 2011-01-11 13:21 UTC (History)
2 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Known to work: 4.5.2
Known to fail: 4.6.0
Last reconfirmed: 2010-11-13 23:29:17

reduced testcase (153 bytes, text/plain)
2010-11-13 22:38 UTC, Zdenek Sojka

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2010-11-13 22:38:25 UTC
Created attachment 22387 [details]
reduced testcase

Compiler output:
$ gcc -O pr46469.C 
pr46469.C: In function 'int identifierByPthreadHandle()':
pr46469.C:12:19: error: inline clone is needed
int pthread_equal()/0(0) @0x7ff98720b000 (asm: pthread_equal) (inline copy in int identifierByPthreadHandle()/2) availability:available analyzed 2 time, 13 benefit 3 size, 5 benefit needed reachable body finalized always_inline
  called by: int identifierByPthreadHandle()/2 (1.00 per call) (inlined) 
  Refering this function: 
pr46469.C:12:19: 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.

(gdb) bt
#0  error (gmsgid=0x12f7fa0 "inline clone is needed") at /mnt/svn/gcc-trunk/gcc/diagnostic.c:747
#1  0x0000000000c11e6c in verify_cgraph_node (node=0x7ffff5d1c000) at /mnt/svn/gcc-trunk/gcc/cgraphunit.c:485
#2  0x0000000000c48ca5 in expand_call_inline (fn=0x7ffff5d0d300) at /mnt/svn/gcc-trunk/gcc/tree-inline.c:3831
#3  gimple_expand_calls_inline (fn=0x7ffff5d0d300) at /mnt/svn/gcc-trunk/gcc/tree-inline.c:4081
#4  optimize_inline_calls (fn=0x7ffff5d0d300) at /mnt/svn/gcc-trunk/gcc/tree-inline.c:4232
#5  0x0000000000c1ef07 in cgraph_early_inlining () at /mnt/svn/gcc-trunk/gcc/ipa-inline.c:1831
#6  0x000000000090723f in execute_one_pass (pass=0x177c880) at /mnt/svn/gcc-trunk/gcc/passes.c:1560
#7  0x0000000000907505 in execute_pass_list (pass=0x177c880) at /mnt/svn/gcc-trunk/gcc/passes.c:1615
#8  0x000000000090672c in do_per_function_toporder (callback=0x9074f0 <execute_pass_list>, data=0x1779c00)
    at /mnt/svn/gcc-trunk/gcc/passes.c:1153
#9  0x00000000009079b6 in execute_ipa_pass_list (pass=0x1779d20) at /mnt/svn/gcc-trunk/gcc/passes.c:1932
#10 0x0000000000c154c8 in ipa_passes () at /mnt/svn/gcc-trunk/gcc/cgraphunit.c:1694
#11 cgraph_optimize () at /mnt/svn/gcc-trunk/gcc/cgraphunit.c:1763
#12 0x0000000000c1568a in cgraph_finalize_compilation_unit () at /mnt/svn/gcc-trunk/gcc/cgraphunit.c:1015
#13 0x0000000000585c1d in cp_write_global_declarations () at /mnt/svn/gcc-trunk/gcc/cp/decl2.c:3973
#14 0x00000000009f3e86 in compile_file (argc=3, argv=0x7fffffffdf28) at /mnt/svn/gcc-trunk/gcc/toplev.c:885
#15 do_compile (argc=3, argv=0x7fffffffdf28) at /mnt/svn/gcc-trunk/gcc/toplev.c:2313
#16 toplev_main (argc=3, argv=0x7fffffffdf28) at /mnt/svn/gcc-trunk/gcc/toplev.c:2374
#17 0x00007ffff6579bbd in __libc_start_main () from /lib/libc.so.6
#18 0x00000000004cadf5 in _start ()

Tested revisions:
r166703 - crash
r165699 - OK
4.5 r166509 - OK
Comment 1 H.J. Lu 2010-11-13 23:29:17 UTC
It is caused by revision 165972:

Comment 2 David Binderman 2011-01-03 15:26:01 UTC
(In reply to comment #1)
> It is caused by revision 165972:
> http://gcc.gnu.org/ml/gcc-cvs/2010-10/msg01159.html

This still seems to be broken in the 20110101 4.6 snapshot.

I've found about a dozen duplicates in the Fedora rawhide source
code tree, so it looks pretty important to me.
Comment 3 Jan Hubicka 2011-01-07 21:11:39 UTC
Seems like inliner only needs to drop needed flag when making extern inline function to disappear.
Comment 4 Jan Hubicka 2011-01-07 21:18:16 UTC
I think we also should drop needed flags on extern symbols once cgraph is fully built.
Comment 5 Jan Hubicka 2011-01-08 16:34:03 UTC
Author: hubicka
Date: Sat Jan  8 16:33:57 2011
New Revision: 168598

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168598
	PR tree-optmization/46469
	* ipa.c (function_and_variable_visibility): Clear needed flags on
	nodes with external decls; handle weakrefs merging correctly.

	* g++.dg/torture/pr46469.C: New testcase.

Comment 6 Jan Hubicka 2011-01-08 16:37:20 UTC
Comment 7 Jan Hubicka 2011-01-11 13:21:56 UTC
bah, really fixed ;)