[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / g++.dg / pr69123.C
blob0546e2074a5390a483d351a55831b383bc453c30
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -g" } */
4 /* This was reduced from gcc/tree-vect-slp.c by H.J.Lu.  */
6 struct xxx_def;
7 typedef xxx_def *xxx;
9 union rtxxx
11   const char *rt_str;
12   xxx rt_xxx;
15 struct xxx_def {
16   union u {
17     rtxxx fld[1];
18   } u;
21 extern xxx bar (void);
22 extern int foo1 (xxx);
24 static inline xxx
25 foo2 (xxx arg0, xxx arg1)
27   xxx rt;
28   rt = bar ();
29   (((rt)->u.fld[0]).rt_xxx) = arg0;
30   (((rt)->u.fld[1]).rt_xxx) = arg1;
31   return rt;
34 static inline xxx
35 foo4 (const char *arg0 )
37   xxx rt;
38   rt = bar ();
39   (((rt)->u.fld[0]).rt_str) = arg0;
40   (((rt)->u.fld[1]).rt_xxx) = (xxx) 0;
41   return rt;
44 extern xxx foo5 (long);
46 struct address_cost_data
48   unsigned costs[2][2][2][2];
51 void
52 get_address_cost (address_cost_data *data)
54   unsigned acost;
55   long i;
56   long rat, off = 0;
57   unsigned sym_p, var_p, off_p, rat_p;
58   xxx addr, base;
59   xxx reg0, reg1;
61   reg1 = bar ();
62   addr = foo2 (reg1, (xxx) 0);
63   rat = 1;
64   acost = 0;
65   reg0 = bar ();
66   reg1 = bar ();
68   for (i = 0; i < 16; i++)
69     {
70       sym_p = i & 1;
71       var_p = (i >> 1) & 1;
72       off_p = (i >> 2) & 1;
73       rat_p = (i >> 3) & 1;
75       addr = reg0;
76       if (rat_p)
77         addr = foo2 (addr, foo5 (rat)) ;
79       if (var_p)
80         addr = foo2 (addr, reg1);
82       if (sym_p)
83         base = foo4 ("");
84       else if (off_p)
85         base = foo5 (off);
86       else
87         base = (xxx) 0;
89       if (base)
90         addr = foo2 (addr, base);
92       acost = foo1 (addr);
93       data->costs[sym_p][var_p][off_p][rat_p] = acost;
94     }