Created attachment 24443 [details] usage.i With 4.6.1 20110606 (and 4.7) and /pkg/gcc-4.6-110606/libexec/gcc/x86_64-unknown-linux-gnu/4.6.1/cc1 -fpreprocessed usage.i -quiet -dumpbase usage.c -mtune=generic -march=x86-64 -auxbase-strip usage.o -g -O2 -Wall -version -fprofile-use -o usage.s I get GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: ecc22bd7305923b0c90b3c641509cfa5 Program received signal SIGSEGV, Segmentation fault. gimple_ic (all=23, count=23, prob=10000, icall_stmt=0x7ffff6b79aa0, direct_call=<value optimized out>) at ../../gcc/gcc/value-prof.c:1156 1156 (gdb) bt #0 gimple_ic (all=23, count=23, prob=10000, icall_stmt=0x7ffff6b79aa0, direct_call=<value optimized out>) at ../../gcc/gcc/value-prof.c:1156 #1 gimple_ic_transform (all=23, count=23, prob=10000, icall_stmt=0x7ffff6b79aa0, direct_call=<value optimized out>) at ../../gcc/gcc/value-prof.c:1274 #2 gimple_value_profile_transformations (all=23, count=23, prob=10000, icall_stmt=0x7ffff6b79aa0, direct_call=<value optimized out>) at ../../gcc/gcc/value-prof.c:528 #3 0x0000000000767e2b in tree_profiling () at ../../gcc/gcc/tree-profile.c:484 #4 0x0000000000689399 in execute_one_pass (pass=0x1097a20) at ../../gcc/gcc/passes.c:1556 #5 0x0000000000689a3a in execute_ipa_pass_list (pass=0x1097a20) at ../../gcc/gcc/passes.c:1923 #6 0x0000000000898efc in ipa_passes () at ../../gcc/gcc/cgraphunit.c:1783 #7 cgraph_optimize () at ../../gcc/gcc/cgraphunit.c:1855 #8 0x00000000008990aa in cgraph_finalize_compilation_unit () at ../../gcc/gcc/cgraphunit.c:1096 #9 0x000000000049e405 in c_write_global_declarations () at ../../gcc/gcc/c-decl.c:9871 #10 0x000000000071a848 in compile_file () at ../../gcc/gcc/toplev.c:591 #11 do_compile () at ../../gcc/gcc/toplev.c:1900 #12 toplev_main () at ../../gcc/gcc/toplev.c:1963 #13 0x00007ffff71dfa7d in __libc_start_main () from /lib64/libc.so.6 #14 0x000000000048de09 in _start () at ../sysdeps/x86_64/elf/start.S:113
Created attachment 24444 [details] profile feedback input file
Created attachment 24445 [details] gcc46-pr49299-test.patch Reduced testcase. The problem is that gimple_ic doesn't expect the indirect call might be noreturn.
Thanks I'll drop the noreturn as workaround
It doesn't make too much sense to profile (cold) noreturn functions. It's probably easiest to not do it (check we have an outgoing edge). Another testcase would be triggering the transform to a noreturn function (so technically a sort-of invalid testcase).
Created attachment 24447 [details] gcc46-pr49299.patch Untested fix. Turning of a normal indirect call into an optionally direct noreturn call seems to work and worked before too. Anyway, if you prefer to just give up in gimple_ic_transform instead, like /* Don't optimize noreturn calls, they should be cold. */ if (gimple_call_flags (stmt) & ECF_NORETURN) return false; I can test that instead.
Author: jakub Date: Tue Jun 7 09:48:53 2011 New Revision: 174738 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174738 Log: PR gcov-profile/49299 * value-prof.c (gimple_ic): Don't assume icall has a fallthru edge. * gcc.dg/tree-prof/pr49299-1.c: New test. * gcc.dg/tree-prof/pr49299-2.c: New test. Added: trunk/gcc/testsuite/gcc.dg/tree-prof/pr49299-1.c trunk/gcc/testsuite/gcc.dg/tree-prof/pr49299-2.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/value-prof.c
Author: jakub Date: Tue Jun 7 09:53:17 2011 New Revision: 174739 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174739 Log: PR gcov-profile/49299 * value-prof.c (gimple_ic): Don't assume icall has a fallthru edge. * gcc.dg/tree-prof/pr49299-1.c: New test. * gcc.dg/tree-prof/pr49299-2.c: New test. Added: branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/tree-prof/pr49299-1.c branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/tree-prof/pr49299-2.c Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/testsuite/ChangeLog branches/gcc-4_6-branch/gcc/value-prof.c
Should be fixed now.