PR tree-optimization/86415 - strlen() not folded for substrings within constant arrays
[official-gcc.git] / gcc / testsuite / g++.dg / pr85026.C
blobe1e3ccd2e354880e15715210051ed549e54b9396
1 /* PR target/85026.  */
2 /* { dg-do assemble } */
3 /* { dg-options "-O2 -std=gnu++11" } */
5 template <class> class a;
6 class b;
7 struct c {
8   typedef a<b> &g;
9 };
10 template <typename d> struct e { typedef typename d::f iter; };
11 class h {
12 public:
13   void __attribute__((noreturn)) i();
14 } ab;
15 template <class> class a {
16 public:
17   typedef b *f;
18   b &operator[](unsigned m) {
19     if (ac)
20       ab.i();
21     return ad[m];
22   }
23   f n() { return ad; }
24   f m_fn3();
25   b *ad;
26   unsigned ac;
28 class b {
29 public:
30   short j;
31   short k;
32   signed l;
33 } __attribute__((__packed__));
34 void o(a<b> &m, b &p2, b &p) {
35   p2 = p = m[0];
36   if (bool at = false)
37     ;
38   else
39     for (c::g au(m);; at = true)
40       if (bool av = false)
41         ;
42       else
43         for (e<a<int>>::iter aw = au.n(), ax = au.m_fn3(); ax;
44              av ? (void)0 : (void)0)
45           if (bool ay = 0)
46             ;
47           else
48             for (b az = *aw; !ay; ay = true) {
49               if (p2.j)
50                 p2.j = az.j;
51               else if (p.j)
52                 p.j = az.j;
53               if (p2.k)
54                 p2.k = az.k;
55               else if (az.k > p.k)
56                 p.k = az.k;
57               if (az.l < p2.l)
58                 if (az.l > p.l)
59                   p.l = az.l;
60             }