Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / testsuite / gcc.dg / 20020310-1.c
blob6067e190622568b522e27620331f582f935f5dab
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-*-* } } */
6 /* { dg-skip-if "" { i?86-*-* } { "-m64" } { "" } } */
8 struct A
10 struct A *a;
11 int b;
14 struct B
16 struct A *c;
17 unsigned int d;
20 struct A p = { &p, -1 };
21 struct B q = { &p, 0 };
23 extern void abort (void);
24 extern void exit (int);
26 struct B *
27 foo (void)
29 return &q;
32 void
33 bar (void)
35 struct B *e = foo ();
36 struct A *f = e->c;
37 int g = f->b;
39 if (++g == 0)
41 e->d++;
42 e->c = f->a;
45 f->b = g;
48 int
49 main ()
51 bar ();
52 if (p.b != 0 || q.d != 1 || q.c != &p)
53 abort ();
54 exit (0);