Bug 47086 - [4.5/4.6 Regression] ICE: verify_flow_info failed: BB 3 can not throw but has an EH edge with -O -fexceptions -fnon-call-exceptions -ftrapv
Summary: [4.5/4.6 Regression] ICE: verify_flow_info failed: BB 3 can not throw but has...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.6.0
: P2 normal
Target Milestone: 4.6.0
Assignee: Jeffrey A. Law
URL:
Keywords: ice-on-valid-code
: 47087 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-28 20:48 UTC by Zdenek Sojka
Modified: 2011-01-11 14:42 UTC (History)
3 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build:
Known to work:
Known to fail: 4.6.0
Last reconfirmed: 2010-12-29 02:47:00


Attachments
reduced testcase (from gcc.c-torture/execute/pr43220.c) (72 bytes, text/plain)
2010-12-28 20:48 UTC, Zdenek Sojka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2010-12-28 20:48:07 UTC
Created attachment 22860 [details]
reduced testcase (from gcc.c-torture/execute/pr43220.c)

Compiler output:
$ gcc -O -fexceptions -fnon-call-exceptions -ftrapv pr47086.c 
pr47086.c: In function 'foo':
pr47086.c:2:1: error: BB 3 can not throw but has an EH edge
pr47086.c:2:1: internal compiler error: verify_flow_info failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Tested revisions:
r168296 - crash

I don't know if this is a regression or not.
Comment 1 H.J. Lu 2010-12-29 02:47:00 UTC
It is caused by revision 151676:

http://gcc.gnu.org/ml/gcc-cvs/2009-09/msg00423.html
Comment 2 Jeffrey A. Law 2011-01-10 15:53:33 UTC
We're deleting the last instruction in a loop which traps.  The loop exit edge is marked as an EH edge.  With the EH edge, but no trapping insn, the CFG verifier fails.

Patch in testing.
Comment 3 Jeffrey A. Law 2011-01-11 14:10:58 UTC
Author: law
Date: Tue Jan 11 14:10:54 2011
New Revision: 168659

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

	* PR tree-optimization/47086
	* tree-ssa-loop-ivopts.c (find_givs_in_stmt_scev): Do not record
	IVs from statements that might throw.

	* PR tree-optimization/47086
	* gcc.dg/pr47086.c: New test.


Added:
    trunk/gcc/testsuite/gcc.dg/pr47086.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-loop-ivopts.c
Comment 4 Jeffrey A. Law 2011-01-11 14:11:27 UTC
Fixed on trunk
Comment 5 Jeffrey A. Law 2011-01-11 14:16:18 UTC
*** Bug 47087 has been marked as a duplicate of this bug. ***
Comment 6 Zdenek Sojka 2011-01-11 14:21:49 UTC
Thank you for fixing this.

It is not planned for backport to 4.5? Target Milestone set to 4.5.3 will cause this bug to be shown as fixed in 4.5.3, which is not true.
Comment 7 Jeffrey A. Law 2011-01-11 14:42:40 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/11/11 07:22, zsojka at seznam dot cz wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47086
> 
> --- Comment #6 from Zdenek Sojka <zsojka at seznam dot cz> 2011-01-11 14:21:49 UTC ---
> Thank you for fixing this.
> 
> It is not planned for backport to 4.5? Target Milestone set to 4.5.3 will cause
> this bug to be shown as fixed in 4.5.3, which is not true.
> 
I wasn't planning to backport the fix; however, if you wish to do so and
ask the 4.5.x branch maintainer to include the fix it wouldn't be
terribly hard.

I fixed the target milestone.

Thanks,
Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNLGxSAAoJEBRtltQi2kC7ISsIALIyXthTTNESWwlh2GqUsg9/
c2zFnrd4Ijvypwgq3pua9LE4UV+LFdGEW6zUHyi1FpcwXvXL+GcO06DVyjRn39sf
RdU0VRIknXMaPJbFjGzMHAvJQb2zfjGYxEfB6+qOPNtO+l4d5+YtIIwNQmUHRYxH
dTsSDzYZ1BXx6/64AJJrCXNKd+gmXvzxHiwc1qOgPYaks3a25i3LjK5YvLTwSAiT
xqtW/i8Atmupesvf43l2TRqiyCd62xcBkQW7kaKyNg+uZVm+agfvfW0v4Ln7MS8K
HUIvTkifh2KxqLnBMNeN4udws3QX0zkGM3Tsu5OXVeBU+ysE5JPXwAIY2kPYUmM=
=neNR
-----END PGP SIGNATURE-----