[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gcc.dg / 20020310-1.c
blob09b83225ad0b2e9e0f4d8db8ede4b4afcac3e3da
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-*-* } && ia32 } } } */
6 /* { dg-xfail-if "doesn't support self-referential initializers" { nvptx-*-* } } */
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);