111
|
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-*-* } } */
|
|
7
|
|
8 struct A
|
|
9 {
|
|
10 struct A *a;
|
|
11 int b;
|
|
12 };
|
|
13
|
|
14 struct B
|
|
15 {
|
|
16 struct A *c;
|
|
17 unsigned int d;
|
|
18 };
|
|
19
|
|
20 struct A p = { &p, -1 };
|
|
21 struct B q = { &p, 0 };
|
|
22
|
|
23 extern void abort (void);
|
|
24 extern void exit (int);
|
|
25
|
|
26 struct B *
|
|
27 foo (void)
|
|
28 {
|
|
29 return &q;
|
|
30 }
|
|
31
|
|
32 void
|
|
33 bar (void)
|
|
34 {
|
|
35 struct B *e = foo ();
|
|
36 struct A *f = e->c;
|
|
37 int g = f->b;
|
|
38
|
|
39 if (++g == 0)
|
|
40 {
|
|
41 e->d++;
|
|
42 e->c = f->a;
|
|
43 }
|
|
44
|
|
45 f->b = g;
|
|
46 }
|
|
47
|
|
48 int
|
|
49 main ()
|
|
50 {
|
|
51 bar ();
|
|
52 if (p.b != 0 || q.d != 1 || q.c != &p)
|
|
53 abort ();
|
|
54 exit (0);
|
|
55 }
|