svn merge -r102224:107263 svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-3_4-branch
[official-gcc.git] / gcc / testsuite / gcc.dg / 20020310-1.c
blob39fbdb0c96bd792e0382fe20217a507afcc5e528
1 /* PR optimization/5844
2 This testcase was miscompiled because of an rtx sharing bug. */
3 /* { dg-do run } */
4 /* { dg-options "-O2" } */
5 /* { dg-options "-O2 -mtune=i586" { target i?86-*-* } } */
7 struct A
9 struct A *a;
10 int b;
13 struct B
15 struct A *c;
16 unsigned int d;
19 struct A p = { &p, -1 };
20 struct B q = { &p, 0 };
22 extern void abort (void);
23 extern void exit (int);
25 struct B *
26 foo (void)
28 return &q;
31 void
32 bar (void)
34 struct B *e = foo ();
35 struct A *f = e->c;
36 int g = f->b;
38 if (++g == 0)
40 e->d++;
41 e->c = f->a;
44 f->b = g;
47 int
48 main ()
50 bar ();
51 if (p.b != 0 || q.d != 1 || q.c != &p)
52 abort ();
53 exit (0);