Bug 22425 - [4.1 regression] ICE in loop_givs_rescan, at loop.c:5521
Summary: [4.1 regression] ICE in loop_givs_rescan, at loop.c:5521
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks: 20126
  Show dependency treegraph
 
Reported: 2005-07-12 04:07 UTC by Serge Belyshev
Modified: 2005-08-04 23:09 UTC (History)
3 users (show)

See Also:
Host:
Target: x86_64-*-linux-gnu
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 Serge Belyshev 2005-07-12 04:07:00 UTC
Here is tescase for this ICE, which was first mentioned in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20126#c26 . 
It still fails on mainline.

------------------------------------------------------------------------------
// compile with -O2

static struct
{
  unsigned int p, f;
} s[] ={
  { 0x08, 625 },
  { 0x09, 1250 },
  { 0x0a, 2500 },
  { 0x0b, 3030 },
  { 0x0c, 5000 }
};

unsigned int foo (unsigned int f)
{
  int i, n;
  
  n = sizeof (s) / sizeof (s[0]);
  for (i = 0; i < n; i++)
    if (f == s[i].f)
      return 100000000 / s[i].p;
  return 10000000 / f;
}
Comment 1 Andrew Pinski 2005-08-04 22:41:51 UTC
This works in "4.1.0 20050802".
Comment 2 Serge Belyshev 2005-08-04 23:09:56 UTC
Fixed by this patch:

	2005-07-14  Alexandre Oliva  <aoliva@redhat.com>
	Ulrich Weigand  <uweigand@de.ibm.com>
	
	PR target/20126
	* loop.c (loop_givs_rescan): Do not ICE if unable to reduce an IV
	in some insn.