2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / opt / pr52727.C
blobed8b973ff65426d7614bbf10ce12a94e364fadca
1 // { dg-do compile }
2 // { dg-options "-g -Os" }
3 // { dg-additional-options "-march=i686" { target ia32 } }
5 int grow (int);
6 void fn (int);
7 struct A { int a1, a2; };
8 template <typename T>
9 struct B
11   A *b;
12   ~B () { b3 (b); }
13   void b1 (int);
14   void b2 (int);
15   void b3 (A *);
17 struct C { int c1, c2, c3; bool c4; };
18 int
19 bar (int x)
21   int y = x / 6;
22   if (y > x / 2)
23     return y;
24   return 0;
26 void baz (double, double);
27 void
28 foo (const C *x, int y, int z)
30   B<int> p;
31   double r = y / 2;
32   int w = bar (int (r));
33   double s = y / 2 + 0.5;
34   double t = z / 2 + 0.5;
35   int u = x->c3;
36   int v = (x->c2 + u - 1 - x->c1) / u;
37   p.b2 ((2 * v > p.b->a1 || (2 * v < p.b->a2 && 2 * v < (p.b->a1 >> 1)))
38         ? grow (0) : p.b->a1);
39   for (int i = 0; i <= v; ++i)
40     {
41       double l = x->c4 ? 4.5 - i * 6.2 / v : (3.1 - i * 31 / v) / 6;
42       baz (s + (r - w) * l, t - (r - w) * l);
43     }