Bug 41835

Summary: ICE with -flto -O3 (BB N can not throw but has an EH edge)
Product: gcc Reporter: Andrew Pinski <pinskia>
Component: tree-optimizationAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, hubicka
Priority: P3 Keywords: ice-on-valid-code, lto
Version: 4.5.0   
Target Milestone: 4.5.0   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2009-10-26 20:56:03

Description Andrew Pinski 2009-10-26 19:06:06 UTC
Looks like something is not removing the EH edges.
Anyways here is a simple testcase:
file 1):
void Stop_Profile( void );
struct CProfileSample { 
  ~CProfileSample( void )  { 
  Stop_Profile(); 
 }
};
void integrateVelocities(int);
void predictUnconstraintMotion(int size)
{
  CProfileSample __profile;
  for ( int i=0;i<size;i++) 
    integrateVelocities(1);
}

--- CUT ---
File 2:
void integrateVelocities(int) { }
void Stop_Profile( void ) {  }

--- CUT ---
Comment 1 Richard Biener 2009-10-26 20:56:02 UTC
Confirmed.  There is a crude fixup pass, but this should be handled by
IPA nothrow (which doesn't exist).
Comment 2 Jan Hubicka 2009-12-11 11:37:57 UTC
ipa nothrow is hidden in ipa-pure-const (that should be renamed eventually).
However issue here is that at IPA stage we should not touch function bodies, so we should not do these updates.  This is why fixup pass exists to resolve these cases after we get into local compilation.

This however seems like LTO is getting something wrong, we do make throw flags to disappear at IPA for quite some time.
Comment 3 Richard Biener 2010-04-23 15:38:12 UTC
Seems to work for me, even with the 4.5.0 release.
Comment 4 Jan Hubicka 2010-04-25 23:44:30 UTC
Subject: Re:  ICE with -flto -O3 (BB N can not
	throw but has an EH edge)

> Seems to work for me, even with the 4.5.0 release.
Note that on mainline the code removing wpa fixup should help here too.  There clearly was bugs.

Honza