Bug 41730 - ICE with -flto -fwhole-program
Summary: ICE with -flto -fwhole-program
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.5.0
Assignee: Not yet assigned to anyone
URL:
Keywords: lto
Depends on:
Blocks:
 
Reported: 2009-10-16 13:54 UTC by Richard Biener
Modified: 2009-10-22 13:11 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2009-10-16 13:54:04 UTC
> ./g++ -B. -B ../x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -O -flto -fwhole-program auto_derivative_function.3.ii
lto1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

for

template <int dim> 
struct AutoDerivativeFunction {
    virtual void gradient_list (void);
};
template <int dim>
void AutoDerivativeFunction<dim>::gradient_list (void)
{
}
template class AutoDerivativeFunction<1>;
int main() {}


The ICE happens in IPA pure-const:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000b91ebb in propagate ()
    at /space/rguenther/src/svn/trunk/gcc/ipa-pure-const.c:876
876               if (pure_const_state < w_l->pure_const_state)
(gdb) p w_l
$1 = (funct_state) 0x0
(gdb) bt
#0  0x0000000000b91ebb in propagate ()
    at /space/rguenther/src/svn/trunk/gcc/ipa-pure-const.c:876
#1  0x00000000007d5dbd in execute_one_pass (pass=0x14b08c0)
    at /space/rguenther/src/svn/trunk/gcc/passes.c:1519


The ICE goes away when dropping either -flto or -fwhole-program.
Comment 1 Richard Biener 2009-10-16 13:54:21 UTC
This breaks 447.dealII build currently.
Comment 2 Jan Hubicka 2009-10-22 00:29:06 UTC
Subject: Re:   New: ICE with -flto -fwhole-program

The problem here is that ipa-pure-const skips analysis of overwrittable
nodes.  But with LTO and whole program the nodes might look
overwrittable at compile time, but at link time we want to use their
analysis.  Additionally we assume that function without bodies are
opaque that is not true too, so in fact we are limitting the pass to
single file only.

Same problem is with the other ipa-* passes, I am testing patch for this
pass and looking into others.

Honza
Comment 3 Richard Biener 2009-10-22 13:11:14 UTC
Subject: Bug 41730

Author: rguenth
Date: Thu Oct 22 13:10:55 2009
New Revision: 153455

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153455
Log:
2009-10-22  Richard Guenther  <rguenther@suse.de>

	PR lto/41730
	* g++.dg/lto/20091022-1_0.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/lto/20091022-1_0.C
Modified:
    trunk/gcc/testsuite/ChangeLog

Comment 4 Richard Biener 2009-10-22 13:11:16 UTC
Fixed.
Comment 5 Jan Hubicka 2009-10-22 13:32:07 UTC
Subject: Bug 41730

Author: hubicka
Date: Thu Oct 22 13:31:48 2009
New Revision: 153456

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

	* ipa-cp.c (ipcp_read_summary): Remove now invalid FIXME and
	flag_ltrans check.
	* ipa-inline.c (cgraph_mark_inline_edge,
	cgraph_decide_inlining_of_small_function,
	cgraph_decide_inlining, inline_read_summary): Disable indirect inlining
	for WPA for time being.

	PR tree-optimize/40556                                                                                                                                         
	* ipa-inline.c (cgraph_early_inlining): Fix iterations condition.

Fix PR number for earlier patch to:
	PR lto/41730

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-cp.c
    trunk/gcc/ipa-inline.c