Bug 35149 - [4.3 Regression] ICE: in expand_call_inline, at tree-inline.c:2653
Summary: [4.3 Regression] ICE: in expand_call_inline, at tree-inline.c:2653
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.3.0
: P2 normal
Target Milestone: 4.3.0
Assignee: Jan Hubicka
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2008-02-09 19:09 UTC by p.vanhoof@oma.be
Modified: 2008-02-15 11:15 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.2.3
Known to fail:
Last reconfirmed: 2008-02-13 13:26:45


Attachments
test case that fails (143.25 KB, application/octet-stream)
2008-02-09 19:11 UTC, p.vanhoof@oma.be
Details
slightly reduced testcase (40.05 KB, text/plain)
2008-02-10 09:52 UTC, Ralf Wildenhues
Details
fix mime type of gzipped testcase (40.05 KB, application/x-gzip)
2008-02-10 09:53 UTC, Ralf Wildenhues
Details
slightly more reduced testcase (8.64 KB, application/x-gzip)
2008-02-10 13:55 UTC, Ralf Wildenhues
Details

Note You need to log in before you can comment on or make changes to this bug.
Description p.vanhoof@oma.be 2008-02-09 19:09:03 UTC
When the attached code is compiled with

g++ -finline -DBOUNDS_CHECK -c ion_recomb_Badnell.ii

you get

/usr/local/gcc430/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/basic_string.h: In member function ‘T& n_pointer<T, d, 1, ARPA_TYPE, true>::operator[](size_t) const [with T = t_quantumState, int d = 3]’:
/usr/local/gcc430/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/basic_string.h:494: internal compiler error: in expand_call_inline, at tree-inline.c:2653
Please submit a full bug report, ....

g++ -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc430/configure --prefix=/usr/local/gcc430 --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.3.0 20080201 (experimental) (GCC)

I could reproduce the bug on i686-pc-linux-gnu as well. I only got it with g++ 4.3.0, not with 4.2.2, 4.1.2, or 4.0.4.

PS - My apologies for the large test case. I tried to reduce it, but got totally frustrated because removing code almost invariably made the bug go away.
Comment 1 p.vanhoof@oma.be 2008-02-09 19:11:28 UTC
Created attachment 15124 [details]
test case that fails
Comment 2 Ralf Wildenhues 2008-02-10 09:52:16 UTC
Created attachment 15126 [details]
slightly reduced testcase

This is what multidelta gets me (see
<http://gcc.gnu.org/wiki/A_guide_to_testcase_reduction>).
Sorry, I don't have time for manual reduction ATM.
Comment 3 Ralf Wildenhues 2008-02-10 09:53:25 UTC
Created attachment 15127 [details]
fix mime type of gzipped testcase
Comment 4 Ralf Wildenhues 2008-02-10 13:55:09 UTC
Created attachment 15128 [details]
slightly more reduced testcase
Comment 5 Richard Biener 2008-02-10 23:01:45 UTC
I can confirm the ICE on i686 with -m64 (the reduced testcase doesn't fail with
-m32 on i686 for me).  Adding any optimization flag makes the ICE go away (thus,
non-SSA inlining ICEs).

      /* We have missing edge in the callgraph.  This can happen in one case
         where previous inlining turned indirect call into direct call by
         constant propagating arguments.  In all other cases we hit a bug
         (incorrect node sharing is most common reason for missing edges.  */
      gcc_assert (dest->needed || !flag_unit_at_a_time);

more reduction is necessary here.  I also think this is a minor issue
due to the fact it only triggers at -O0 with inlining.  Works for me
with 4.2.3.
Comment 6 Jan Hubicka 2008-02-13 13:26:45 UTC
I am looking into it.  Obviously cgraph is out of sync for whatever reason.

Honza
Comment 7 Jan Hubicka 2008-02-13 17:29:51 UTC
This one liner actually took me a while.  It is quite ugly ordering issue.
Index: ipa.c
===================================================================
--- ipa.c       (revision 132243)
+++ ipa.c       (working copy)
@@ -192,6 +192,7 @@ cgraph_remove_unreachable_nodes (bool be
                    }
                  cgraph_node_remove_callees (node);
                  node->analyzed = false;
+                 node->local.inlinable = false;
                }
              else
                cgraph_remove_node (node);
Comment 8 Ralf Wildenhues 2008-02-14 06:46:59 UTC
Subject: Re:  [4.3 Regression] ICE: in
	expand_call_inline, at tree-inline.c:2653

* hubicka at gcc dot gnu dot org wrote on Wed, Feb 13, 2008 at 06:29:51PM CET:
> ------- Comment #7 from hubicka at gcc dot gnu dot org  2008-02-13 17:29 -------
> This one liner actually took me a while.  It is quite ugly ordering issue.
> Index: ipa.c
> ===================================================================
> --- ipa.c       (revision 132243)
> +++ ipa.c       (working copy)
> @@ -192,6 +192,7 @@ cgraph_remove_unreachable_nodes (bool be
>                     }
>                   cgraph_node_remove_callees (node);
>                   node->analyzed = false;
> +                 node->local.inlinable = false;
>                 }
>               else
>                 cgraph_remove_node (node);

This patch fixes the failure for me.  Thanks for working on it!
Comment 9 Jan Hubicka 2008-02-15 11:15:36 UTC
Fixed by my patch.
Comment 10 Jan Hubicka 2008-02-15 11:16:33 UTC
Subject: Bug 35149

Author: hubicka
Date: Fri Feb 15 11:15:48 2008
New Revision: 132337

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132337
Log:

	PR middle-end/35149
	* ipa.c (cgraph_remove_unreachable_nodes): Clear local.inlinable flag.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa.c