Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.dg / 20020310-1.c
blobbdd29672bd8189e80afae89e4465b8f4009f0de1
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-*-* x86_64-*-* } && ilp32 } } } */
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);