This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[testcase] Infinite loop in calculate_global_regs_live
- From: Jakub Jelinek <jakub at redhat dot com>
- To: rth at redhat dot com, jh at suse dot cz
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 30 Nov 2001 21:58:20 +0100
- Subject: [testcase] Infinite loop in calculate_global_regs_live
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Although calculate_global_regs_live has a huge comment explaining why the
loop is guaranteed to terminate, the following testcase on IA-64 (-O2)
will cause it to loop forever.
After if_convert, there is one basic block which has itself as one of its
predecessors/successors (ie. a loop) which has one of the registers only
set/modified in cond_exec instructions. calculate_global_regs_live then
alternates forever between propagating that block starting with
global_regs_live_at_end excluding that register (which results in including
it in global_regs_live_at_start) and vice versa.
Ok to commit the testcase for now?
Still looking into it, if somebody would manage to fix this over the
weekend, I'd be thankful though...
2001-11-30 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/compile/20011130-1.c: New test.
--- gcc/testsuite/gcc.c-torture/compile/20011130-1.c.jj Thu Aug 30 22:30:55 2001
+++ gcc/testsuite/gcc.c-torture/compile/20011130-1.c Fri Nov 30 17:20:18 2001
@@ -0,0 +1,46 @@
+typedef struct {
+ unsigned char a;
+ unsigned char b;
+} S0;
+
+typedef struct {
+ S0 *c;
+ int d;
+ unsigned int e;
+ unsigned char *f[3];
+ void *g;
+} S1;
+
+int bar (int, void *);
+
+int foo (S1 *x, float y)
+{
+ S0 *h;
+ int i, j, k, l, m;
+ float n, o, p;
+ unsigned char *q, *r[3];
+
+ h = x->c;
+ m = h->a;
+ l = h->b;
+ n = y;
+ o = 0.0;
+ if (x->d == 8)
+ for (j = 0; j < x->e; j++)
+ for (k = 0; k < 3; k++)
+ {
+ n = y;
+ o = 0.0;
+ if (m)
+ q = x->f[k] + x->e - 1 - j;
+ else
+ q = x->f[k] + j;
+ p = (*q - o) * y / (n - o);
+ p = 0.0 > p ? 0.0 : p;
+ p = y < p ? y : p;
+ if (l)
+ p = r[k][(int) p];
+ bar (p, x->g);
+ }
+ return 1;
+}
Jakub