Bug 48330 - [4.7 Regression] ICE: in optimize_inline_calls, at tree-inline.c:4201 with -fmudflap -fno-early-inlining
Summary: [4.7 Regression] ICE: in optimize_inline_calls, at tree-inline.c:4201 with -f...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.7.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2011-03-29 10:24 UTC by Zdenek Sojka
Modified: 2011-04-18 14:26 UTC (History)
2 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build:
Known to work: 4.6.1
Known to fail: 4.7.0
Last reconfirmed: 2011-03-29 13:13:29


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2011-03-29 10:24:39 UTC
It seems any input file is enough to trigger the assertion.

Compiler output:
$ echo '' > testcase.c
$ gcc -O -fmudflap -fno-early-inlining testcase.c 
testcase.c: In function '_GLOBAL__sub_I_00099_0_testcase.c':
testcase.c:1:0: internal compiler error: in optimize_inline_calls, at tree-inline.c:4201
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

That assert was added in http://gcc.gnu.org/viewcvs?view=revision&revision=171602
Comment 1 Martin Jambor 2011-03-29 12:54:50 UTC
It's mudflap adding call graph nodes from outside the pass manager
again:

(gdb) bt
#0  fancy_abort (file=0x89fd0b8 "/home/mjambor/gcc/icln/src/gcc/tree-inline.c", line=4201, 
    function=0x89fe0a3 "optimize_inline_calls") at /home/mjambor/gcc/icln/src/gcc/diagnostic.c:893
#1  0x086c4642 in optimize_inline_calls (fn=0xb7649100)
    at /home/mjambor/gcc/icln/src/gcc/tree-inline.c:4201
#2  0x08699622 in cgraph_early_inlining () at /home/mjambor/gcc/icln/src/gcc/ipa-inline.c:1757
#3  0x083b43f9 in execute_one_pass (pass=0x8b1f300) at /home/mjambor/gcc/icln/src/gcc/passes.c:1555
#4  0x083b46ad in execute_pass_list (pass=0x8b1f300)
    at /home/mjambor/gcc/icln/src/gcc/passes.c:1610
#5  0x084be2f5 in tree_lowering_passes (fn=0xb7649100)
    at /home/mjambor/gcc/icln/src/gcc/tree-optimize.c:375
#6  0x08688514 in cgraph_lower_function (node=0xb75c63fc)
    at /home/mjambor/gcc/icln/src/gcc/cgraphunit.c:334
#7  0x0868a6c4 in cgraph_analyze_function (node=0xb75c63fc)
    at /home/mjambor/gcc/icln/src/gcc/cgraphunit.c:799
#8  0x086854f7 in cgraph_add_new_function (fndecl=0xb7649100, lowered=0 '\000')
    at /home/mjambor/gcc/icln/src/gcc/cgraph.c:2501
#9  0x086ad21e in cgraph_build_static_cdtor_1 (which=73 'I', body=0xb762d4b0, priority=99, 
    final=0 '\000') at /home/mjambor/gcc/icln/src/gcc/ipa.c:1593
#10 0x08119465 in mudflap_finish_file () at /home/mjambor/gcc/icln/src/gcc/tree-mudflap.c:1366
#11 0x0845c559 in compile_file () at /home/mjambor/gcc/icln/src/gcc/toplev.c:601
#12 do_compile () at /home/mjambor/gcc/icln/src/gcc/toplev.c:1900
#13 toplev_main (argc=20, argv=0xbfffef34) at /home/mjambor/gcc/icln/src/gcc/toplev.c:1963
#14 0x0816cedb in main (argc=20, argv=0xbfffef34) at /home/mjambor/gcc/icln/src/gcc/main.c:36
Comment 2 Martin Jambor 2011-03-29 13:13:29 UTC
The following (untested) patch fixes the issue.  It seems OK to me as
the lowering passes probably should know that the current function is
"analyzed" but I guess we should ask Honza whether it is really
correct:

Index: src/gcc/cgraphunit.c
===================================================================
--- src.orig/gcc/cgraphunit.c
+++ src/gcc/cgraphunit.c
@@ -796,8 +796,8 @@ cgraph_analyze_function (struct cgraph_n
     gimplify_function_tree (decl);
   dump_function (TDI_generic, decl);
 
-  cgraph_lower_function (node);
   node->analyzed = true;
+  cgraph_lower_function (node);
 
   pop_cfun ();
   current_function_decl = save;
Comment 3 Martin Jambor 2011-04-18 14:26:13 UTC
I wanted to re-visit this but it seems to be fixed already (with trunk
revision 172644 at least) so I'm going to close it as resolved.
Please re-open if I am somehow mistaken, thanks.