Bug 29902 - [4.2 Regression] ICE in coalesce_abnormal_edges, at tree-outof-ssa.c:644
Summary: [4.2 Regression] ICE in coalesce_abnormal_edges, at tree-outof-ssa.c:644
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.2.0
: P1 normal
Target Milestone: 4.2.0
Assignee: Zdenek Dvorak
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2006-11-19 22:31 UTC by Martin Michlmayr
Modified: 2007-03-03 00:41 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-11-20 01:01:32


Attachments
testcase (1.66 KB, text/plain)
2006-11-19 22:31 UTC, Martin Michlmayr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Michlmayr 2006-11-19 22:31:41 UTC
I get the following ICE with 4.2.0 20061116 with -fprefetch-loop-arrays:

tbm@coconut0:~$ /usr/lib/gcc-snapshot/bin/g++ -c -O3 libjingle0.3-xmppclient.cpp                      tbm@coconut0:~$ /usr/lib/gcc-snapshot/bin/g++ -c -O -fprefetch-loop-arrays libjingle0.3-xmppclient.cpp
libjingle0.3-xmppclient.cpp: In member function 'virtual buzz::SaslMechanism* buzz::PlainSaslHandler::CreateSaslMechanism(const std::string&)':
libjingle0.3-xmppclient.cpp:231: internal compiler error: in coalesce_abnormal_edges, at tree-outof-ssa.c:644
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
tbm@coconut0:~$
Comment 1 Martin Michlmayr 2006-11-19 22:31:59 UTC
Created attachment 12648 [details]
testcase
Comment 2 Andrew Pinski 2006-11-20 00:23:35 UTC
Reduced testcase:
int length1();
int g(int);
void f(int capacity_, char *old_storage)
{
  try {
    length1();
    int old_capacity = capacity_;
    capacity_ *= 2;
    g(capacity_);
    for (int i = 1; i < old_capacity; i++)
     old_storage[i] = old_storage[i - 1];
  } catch (...) {
    for (int i = 1; i < capacity_; i++){}
  }
}
Comment 3 Andrew Pinski 2006-11-20 00:27:08 UTC
I think after remove empty loops, we should add a DCE pass which should fix the above reduced testcase but will not fix this reduced testcase:
int length1();
int g(int);
void f(int capacity_, char*old_storage)
{
  try {
    length1();
    int old_capacity = capacity_;
    capacity_ *= 2;
    g(capacity_);
    for (int i = 1; i < old_capacity; i++)
     old_storage[i] = old_storage[i - 1];
  } catch (...) {
    for (int i = 1; i < capacity_; i++){old_storage[i] = 0;}
  }
}
Comment 4 Zdenek Dvorak 2006-11-20 01:39:57 UTC
On what target is this? I cannot reproduce it neither on i686 nor from ppc crosscompiler.
Comment 5 Andrew Pinski 2006-11-20 01:41:17 UTC
I could reproduce this with -march=pentium4 -fprefetch-loop-arrays with "4.3.0 20061111" for 4.2.0, you might need --enable-checking.
Comment 6 Martin Michlmayr 2006-11-20 09:25:22 UTC
(In reply to comment #4)
> On what target is this? I cannot reproduce it neither on i686 nor from ppc
> crosscompiler.

I was on ia64.
Comment 7 Zdenek Dvorak 2006-11-21 23:45:30 UTC
Subject: Bug 29902

Author: rakdver
Date: Tue Nov 21 23:45:21 2006
New Revision: 119074

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119074
Log:
	PR tree-optimization/29902
	* tree-ssa-loop-manip.c (can_unroll_loop_p): Return false if
	any involved ssa name appears in abnormal phi node.

	* g++.dg/tree-ssa/pr29902.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/tree-ssa/pr29902.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-loop-manip.c

Comment 8 Andrew Pinski 2006-11-24 02:23:53 UTC
Fixed on the trunk.
Comment 9 Mark Mitchell 2007-02-19 20:43:23 UTC
Zdenek --

Can this patch be backported to 4.2?

Thanks,

-- Mark
Comment 10 Zdenek Dvorak 2007-03-03 00:39:05 UTC
Subject: Bug 29902

Author: rakdver
Date: Sat Mar  3 00:38:56 2007
New Revision: 122501

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122501
Log:
	PR tree-optimization/29902
	* tree-ssa-loop-manip.c (can_unroll_loop_p): Return false if
	any involved ssa name appears in abnormal phi node.

	* g++.dg/tree-ssa/pr29902.C: New test.


Added:
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/tree-ssa/pr29902.C
Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_2-branch/gcc/tree-ssa-loop-manip.c

Comment 11 Zdenek Dvorak 2007-03-03 00:41:12 UTC
> Can this patch be backported to 4.2?

Done.