User account creation filtered due to spam.

Bug 49299 - ICE in gimple_ic on profile feedback build
Summary: ICE in gimple_ic on profile feedback build
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: gcov-profile (show other bugs)
Version: 4.6.1
: P3 normal
Target Milestone: 4.6.1
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-06 09:11 UTC by Andi Kleen
Modified: 2011-06-07 09:55 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-06-06 09:40:44


Attachments
usage.i (63.45 KB, application/octet-stream)
2011-06-06 09:11 UTC, Andi Kleen
Details
profile feedback input file (667 bytes, application/octet-stream)
2011-06-06 09:12 UTC, Andi Kleen
Details
gcc46-pr49299-test.patch (349 bytes, patch)
2011-06-06 09:42 UTC, Jakub Jelinek
Details | Diff
gcc46-pr49299.patch (1.03 KB, patch)
2011-06-06 10:56 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andi Kleen 2011-06-06 09:11:46 UTC
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
Comment 1 Andi Kleen 2011-06-06 09:12:25 UTC
Created attachment 24444 [details]
profile feedback input file
Comment 2 Jakub Jelinek 2011-06-06 09:42:03 UTC
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.
Comment 3 Andi Kleen 2011-06-06 09:50:49 UTC
Thanks I'll drop the noreturn as workaround
Comment 4 Richard Biener 2011-06-06 10:30:12 UTC
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).
Comment 5 Jakub Jelinek 2011-06-06 10:56:55 UTC
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.
Comment 6 Jakub Jelinek 2011-06-07 09:48:57 UTC
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
Comment 7 Jakub Jelinek 2011-06-07 09:53:20 UTC
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
Comment 8 Jakub Jelinek 2011-06-07 09:55:03 UTC
Should be fixed now.