| 1 |
// PR ipa/92421 |
| 2 |
// { dg-do compile } |
| 3 |
// { dg-additional-options "-Wno-return-type" } |
| 4 |
|
| 5 |
// VRP jump threading will create additional __builtin___memcpy_chk calls that |
| 6 |
// may be out of bounds. |
| 7 |
// { dg-additional-options "-Wno-stringop-overflow" } |
| 8 |
|
| 9 |
typedef long a; |
| 10 |
void *b, *c; |
| 11 |
template <typename, typename> class d {}; |
| 12 |
template <typename e, typename f> bool operator!=(d<e, f>, d<e, f>); |
| 13 |
struct g { |
| 14 |
g(const char *); |
| 15 |
}; |
| 16 |
struct j { |
| 17 |
j(); |
| 18 |
void h(); |
| 19 |
void i(); |
| 20 |
void aj(); |
| 21 |
}; |
| 22 |
struct m { |
| 23 |
m(bool); |
| 24 |
}; |
| 25 |
struct n { |
| 26 |
operator a(); |
| 27 |
}; |
| 28 |
struct o { |
| 29 |
long am(); |
| 30 |
}; |
| 31 |
struct H { |
| 32 |
class p {}; |
| 33 |
virtual bool accept(const char *, unsigned long, p *, bool); |
| 34 |
}; |
| 35 |
struct q : H { |
| 36 |
struct r { |
| 37 |
enum at { au, av, aw }; |
| 38 |
}; |
| 39 |
enum { ax }; |
| 40 |
virtual void ay(const char *, int, const char *, r::at, const char *); |
| 41 |
virtual bool az(const g &, unsigned = ax); |
| 42 |
virtual bool ba(const int &, p *, bool); |
| 43 |
void bb(char *bc, long bd, char *, long be) { |
| 44 |
struct bf : public p { |
| 45 |
bf(long) {} |
| 46 |
} bg(be); |
| 47 |
accept(bc, bd, &bg, true); |
| 48 |
} |
| 49 |
}; |
| 50 |
struct s { |
| 51 |
q *bi; |
| 52 |
bool bj(); |
| 53 |
}; |
| 54 |
template <class bk> class t : q { |
| 55 |
bool accept(const char *, unsigned long bd, p *bg, bool) { |
| 56 |
bool k(bp || bq), cl = false, err = false; |
| 57 |
if (br) |
| 58 |
ay("", 1, __func__, r::au, ""); |
| 59 |
if (bs) |
| 60 |
ay("", 6, __func__, r::av, ""); |
| 61 |
char bt[1], cd[1]; |
| 62 |
long bu = sizeof(int) + bd, ce = sizeof(L) + bd; |
| 63 |
char *bw = bu > sizeof(bt) ? new char : bt, |
| 64 |
*cf = ce > sizeof(cd) ? new char : cd; |
| 65 |
__builtin___memcpy_chk(b, c, bd, 0); |
| 66 |
a by[1]; |
| 67 |
int bz = 0; |
| 68 |
u cb = *cc((int *)bw, true, by, &bz); |
| 69 |
ay("", 1, __func__, r::aw, ""); |
| 70 |
if (bw != bt) |
| 71 |
delete bw; |
| 72 |
__builtin___memcpy_chk(b, c, bd, 0); |
| 73 |
cb.ch.i(); |
| 74 |
bool ci = cj((L *)cf, bg); |
| 75 |
bool atran = bq && bp && cb.ck; |
| 76 |
if (atran && !ci && cm(&cb)) |
| 77 |
if (cn > co) { |
| 78 |
int cp = cb.cq % 6; |
| 79 |
v cs = *(ct + cp); |
| 80 |
if (cu(&cs)) |
| 81 |
cl = true; |
| 82 |
} |
| 83 |
if (ci) |
| 84 |
if (k) |
| 85 |
cv.aj(); |
| 86 |
cv.h(); |
| 87 |
b = cc((int *)bw, false, by, &bz); |
| 88 |
if (b) |
| 89 |
if (cw(&cb, by, bz)) |
| 90 |
if (atran && bp && cx()) |
| 91 |
cv.aj(); |
| 92 |
if (cl) |
| 93 |
if (k) |
| 94 |
cv.aj(); |
| 95 |
cv.h(); |
| 96 |
int cp = cb.cq % 6; |
| 97 |
v cs = *(ct + cp); |
| 98 |
if (cy()) |
| 99 |
err = true; |
| 100 |
O da = *(db + cp); |
| 101 |
if (da.dc->am() > cs.dc->am() + cs.dd->am() + 1 && de(&da)) |
| 102 |
cv.aj(); |
| 103 |
return !err; |
| 104 |
} |
| 105 |
bool ba(const int &, p *, bool) { |
| 106 |
d<int, int> kit, df; |
| 107 |
while (kit != df) |
| 108 |
; |
| 109 |
cx(); |
| 110 |
return false; |
| 111 |
} |
| 112 |
bool az(const g &, unsigned) { |
| 113 |
t dj; |
| 114 |
int cur; |
| 115 |
while (cur) { |
| 116 |
int dk, dl; |
| 117 |
char dbuf; |
| 118 |
dj.bb(&dbuf, dl, &dbuf, dk); |
| 119 |
} |
| 120 |
} |
| 121 |
struct L {}; |
| 122 |
struct u { |
| 123 |
j ch; |
| 124 |
a cq; |
| 125 |
bool ck; |
| 126 |
}; |
| 127 |
struct v { |
| 128 |
o *dd; |
| 129 |
o *dc; |
| 130 |
}; |
| 131 |
struct O { |
| 132 |
o *dc; |
| 133 |
}; |
| 134 |
bool cy(); |
| 135 |
bool cu(v *); |
| 136 |
bool cj(L *, p *); |
| 137 |
bool de(O *); |
| 138 |
u *cc(int *, bool, a *, int *); |
| 139 |
bool cw(u *, a *, int); |
| 140 |
bool cx() { |
| 141 |
dm.dn(); |
| 142 |
bool err = false; |
| 143 |
if (dm.l()) |
| 144 |
err = true; |
| 145 |
return !err; |
| 146 |
} |
| 147 |
bool cm(u *); |
| 148 |
j cv; |
| 149 |
int br; |
| 150 |
bool bs; |
| 151 |
bool bq; |
| 152 |
bk dm; |
| 153 |
a co; |
| 154 |
n cn; |
| 155 |
v ct[6]; |
| 156 |
O db[6]; |
| 157 |
bool bp; |
| 158 |
}; |
| 159 |
struct w : q { |
| 160 |
void dn(); |
| 161 |
bool l() { |
| 162 |
m(true); |
| 163 |
if (br) |
| 164 |
ay("", 1087, __func__, r::au, ""); |
| 165 |
return false; |
| 166 |
} |
| 167 |
int br; |
| 168 |
}; |
| 169 |
bool s::bj() { |
| 170 |
bi->az(""); |
| 171 |
new t<w>; |
| 172 |
return false; |
| 173 |
} |