Bug 28221 - [4.1 regression] ICE in add_insn_before, at emit-rtl.c:3479
Summary: [4.1 regression] ICE in add_insn_before, at emit-rtl.c:3479
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: 4.1.2
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-checking, ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2006-07-02 11:13 UTC by Martin Michlmayr
Modified: 2006-08-03 16:39 UTC (History)
7 users (show)

See Also:
Host:
Target: ia64-linux-gnu
Build: ia64-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2006-07-06 10:02:13


Attachments
test case (50.65 KB, application/octet-stream)
2006-07-02 11:13 UTC, Martin Michlmayr
Details
testcase (824 bytes, text/plain)
2006-07-06 10:01 UTC, Richard Biener
Details
patch (4.41 KB, patch)
2006-07-29 22:28 UTC, Debian GCC Maintainers
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Michlmayr 2006-07-02 11:13:08 UTC
[ Forwarded from http://bugs.debian.org/376084 ]

We're seeing the following ICE on ia64 with gcc 4.1:

merulo% g++-4.1 -c -O2 000.c
000.c: In member function 'k3d::mesh* libk3dprimitives::lawn_implementation::on_create_geometry()':
000.c:7597: internal compiler error: in add_insn_before, at emit-rtl.c:3479
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.
Preprocessed source stored into /tmp/ccifNJOx.out file, please attach this to your bugreport.
merulo% g++-4.1 -c -O1 000.c
merulo% g++-4.0 -c -O2 000.c
merulo% /usr/lib/gcc-snapshot/bin/g++ -c -O2 000.c
merulo%
Comment 1 Martin Michlmayr 2006-07-02 11:13:51 UTC
Created attachment 11798 [details]
test case
Comment 2 Richard Biener 2006-07-05 13:36:59 UTC
With checking enabled we have

obj2/gcc> ./cc1plus -quiet -O2 t.ii
t.ii: In static member function 'static IntType boost::random::const_mod<IntType, m>::mult_schrage(IntType, IntType) [with IntType = int, IntType m = 2147483647]':
t.ii:7335: error: too many outgoing branch edges from bb 3
t.ii:7335: internal compiler error: verify_flow_info failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

maybe related to PR27291.
Comment 3 Richard Biener 2006-07-06 10:01:36 UTC
Created attachment 11843 [details]
testcase

reduced C++ testcase attached.  C testcase:

void foo(void)
{
  int value47D2367, valueD2287;
  unsigned int jD2283;
  value47D2367 = x->x;
  jD2283 = 0;

L0:
  if (value47D2367 > 0) goto L3; else goto L17;

L17:
  valueD2287 = value47D2367;

L2:
  valueD2287 = valueD2287 + 2147483647;
  if (valueD2287 > 0) goto L3; else goto L2;

L3:
  jD2283 = jD2283 + 1;
  if (jD2283 != 607) goto L0; else goto L6;

L6:
  return;
}

gcc> ./cc1 -O2 -quiet t.i
t.i: In function 'foo':
t.i:26: error: NOTE_INSN_BASIC_BLOCK is missing for block 8
t.i:26: error: NOTE_INSN_BASIC_BLOCK 92 in middle of basic block 8
t.i:26: error: too many outgoing branch edges from bb 2
t.i:26: internal compiler error: verify_flow_info failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 4 Richard Biener 2006-07-06 10:02:13 UTC
So, confirmed.
Comment 5 Richard Biener 2006-07-06 10:07:32 UTC
The reduced testcases are with checking only.
Comment 6 Richard Biener 2006-07-06 10:10:10 UTC
ICE is after rtl loop2 optimizer, looks like it requires a doloop target.
Comment 7 Richard Biener 2006-07-06 10:11:51 UTC
Really looks like a dup of PR27291, but the patch for that doesn't apply to the 4.1 branch.
Comment 8 Steve Ellcey 2006-07-28 21:45:25 UTC
If we apply the patch from http://gcc.gnu.org/ml/gcc-patches/2005-11/msg02094.html first then we can apply the patch for PR 27291.  I did this on the 4.1 branch and the bug went away.  I have not done a full bootstrap with the two patches but will do that over the weekend.
Comment 9 Debian GCC Maintainers 2006-07-29 22:28:52 UTC
Created attachment 11967 [details]
patch

combined and bootstrapped with the two patches mentioned in #8 with no regressions on i486-linux-gnu.

  Matthias
Comment 10 Steve Ellcey 2006-07-31 16:19:36 UTC
My weekend bootstrapping and testing on ia64-hp-hpux11.23 and ia64 Linux on the 4.1 branch showed no regressions.  I think I should send email to gcc-patches before checking it in on the 4.1 branch since the first patch is not technically a regression fix.  Unless someone else wants to handle the checkin on the 4.1 branch?
Comment 11 Steve Ellcey 2006-08-03 16:35:45 UTC
Subject: Bug 28221

Author: sje
Date: Thu Aug  3 16:35:31 2006
New Revision: 115904

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115904
Log:
	PR rtl-optimization/28221
	Backport from mainline.
	2005-11-30  Nathan Sidwell  <nathan@codesourcery.com>
	* loop-doloop.c (add_test): Only add jump note if we did emit a jump.
	2006-05-01  Zdenek Dvorak  <dvorakz@suse.cz>
	PR rtl-optimization/27291
	* loop-doloop.c (add_test, doloop_modify): Handle the case condition
	is folded to a constant.

Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/loop-doloop.c

Comment 12 Steve Ellcey 2006-08-03 16:39:32 UTC
Fixed by backporting Nathan's patch and the fix for PR 27291.