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; }
This works in "4.1.0 20050802".
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.