OSDN Git Service

PR rtl-optimization/52139
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / pr2480.c
1 /* { dg-do link } */
2 /* { dg-options "-O2" } */
3
4 /* We have enough cascading at -O2 to cover the missed control-dependence
5    in SCCVN (which considers the link_error calls to clobber the structs).  */
6
7 struct example
8 {
9   char a;
10   int b;
11   char c;
12 } *ex1;
13
14 extern void link_error(void);
15
16 void
17 bar (void)
18 {
19   ex1->a = 1;
20   ex1->b = 2;
21   ex1->c = 3;
22
23   if (ex1->a != 1)
24     link_error ();
25   if (ex1->b != 2)
26     link_error ();
27   if (ex1->c != 3)
28     link_error ();
29
30 }
31
32 void
33 foo (struct example *ex2)
34 {
35   ex2->a = 1;
36   ex2->b = 2;
37   ex2->c = 3;
38
39   if (ex2->a != 1)
40     link_error ();
41   if (ex2->b != 2)
42     link_error ();
43   if (ex2->c != 3)
44     link_error ();
45
46 }
47
48 int main (void)
49 {
50   bar ();
51   foo (ex1);
52   return 0;
53 }