// PR rtl-optimization/23478
|
// PR rtl-optimization/23478
|
// { dg-do run }
|
// { dg-do run }
|
// { dg-options "-O2" }
|
// { dg-options "-O2" }
|
|
|
extern "C" void abort ();
|
extern "C" void abort ();
|
bool tthrow;
|
bool tthrow;
|
struct C3 { int i; };
|
struct C3 { int i; };
|
class C14 {};
|
class C14 {};
|
struct C7
|
struct C7
|
{
|
{
|
virtual ~C7 ();
|
virtual ~C7 ();
|
};
|
};
|
|
|
C7::~C7 ()
|
C7::~C7 ()
|
{
|
{
|
asm volatile ("" : : : "memory");
|
asm volatile ("" : : : "memory");
|
}
|
}
|
class C2 : public C7 {};
|
class C2 : public C7 {};
|
|
|
template class C13
|
template class C13
|
{
|
{
|
bool ma;
|
bool ma;
|
X *mb;
|
X *mb;
|
public:
|
public:
|
explicit C13 (X *p = 0) throw () : ma (p != 0), mb (p) {}
|
explicit C13 (X *p = 0) throw () : ma (p != 0), mb (p) {}
|
~C13 ();
|
~C13 ();
|
};
|
};
|
|
|
template
|
template
|
C13::~C13 ()
|
C13::~C13 ()
|
{
|
{
|
asm volatile ("" : : "r" (ma), "r" (mb) : "memory");
|
asm volatile ("" : : "r" (ma), "r" (mb) : "memory");
|
}
|
}
|
|
|
struct C1
|
struct C1
|
{
|
{
|
C1 (const C3 &, const C3 &, const C3 &, const C3 *&);
|
C1 (const C3 &, const C3 &, const C3 &, const C3 *&);
|
};
|
};
|
|
|
C1::C1 (const C3 &, const C3 &, const C3 &, const C3 *&)
|
C1::C1 (const C3 &, const C3 &, const C3 &, const C3 *&)
|
{
|
{
|
if (!tthrow)
|
if (!tthrow)
|
throw 24;
|
throw 24;
|
}
|
}
|
|
|
struct C8
|
struct C8
|
{
|
{
|
struct C15 {};
|
struct C15 {};
|
typedef C15 *C9;
|
typedef C15 *C9;
|
virtual void f1 (C2 &, long *, void *, C3 &, void *, bool) = 0;
|
virtual void f1 (C2 &, long *, void *, C3 &, void *, bool) = 0;
|
virtual C13 f3 () const = 0;
|
virtual C13 f3 () const = 0;
|
virtual ~C8 () {}
|
virtual ~C8 () {}
|
};
|
};
|
|
|
bool
|
bool
|
xx14 ()
|
xx14 ()
|
{
|
{
|
bool b = false;
|
bool b = false;
|
if (tthrow)
|
if (tthrow)
|
throw 6;
|
throw 6;
|
asm volatile ("" : : "r" (&b) : "memory");
|
asm volatile ("" : : "r" (&b) : "memory");
|
return b;
|
return b;
|
}
|
}
|
|
|
bool
|
bool
|
xx2 ()
|
xx2 ()
|
{
|
{
|
bool b = false;
|
bool b = false;
|
if (tthrow)
|
if (tthrow)
|
throw 6;
|
throw 6;
|
asm volatile ("" : : "r" (&b) : "memory");
|
asm volatile ("" : : "r" (&b) : "memory");
|
return b;
|
return b;
|
}
|
}
|
|
|
C13
|
C13
|
xx9 ()
|
xx9 ()
|
{
|
{
|
return C13();
|
return C13();
|
}
|
}
|
|
|
C2 &
|
C2 &
|
xx10 ()
|
xx10 ()
|
{
|
{
|
static C2 c2;
|
static C2 c2;
|
return c2;
|
return c2;
|
}
|
}
|
|
|
C3 &
|
C3 &
|
xx12 ()
|
xx12 ()
|
{
|
{
|
static C3 c3 = { 1 };
|
static C3 c3 = { 1 };
|
return c3;
|
return c3;
|
}
|
}
|
|
|
const C3 &
|
const C3 &
|
xx5 ()
|
xx5 ()
|
{
|
{
|
static const C3 c3 = { 2 };
|
static const C3 c3 = { 2 };
|
return c3;
|
return c3;
|
}
|
}
|
|
|
const C3 *&
|
const C3 *&
|
xx4 ()
|
xx4 ()
|
{
|
{
|
static const C3 *p;
|
static const C3 *p;
|
if (tthrow)
|
if (tthrow)
|
throw 6;
|
throw 6;
|
return p;
|
return p;
|
}
|
}
|
|
|
long ll13;
|
long ll13;
|
|
|
long
|
long
|
xx13 ()
|
xx13 ()
|
{
|
{
|
long ret;
|
long ret;
|
asm volatile ("" : "=r" (ret) : "r" (ll13));
|
asm volatile ("" : "=r" (ret) : "r" (ll13));
|
return ret;
|
return ret;
|
}
|
}
|
|
|
void
|
void
|
xx15 (C3 &x, C13 &y)
|
xx15 (C3 &x, C13 &y)
|
{
|
{
|
asm volatile ("" : : "r" (&x), "r" (&y) : "memory");
|
asm volatile ("" : : "r" (&x), "r" (&y) : "memory");
|
}
|
}
|
|
|
long
|
long
|
xx16 (const void *x)
|
xx16 (const void *x)
|
{
|
{
|
long ret;
|
long ret;
|
asm volatile ("" : "=r" (ret) : "0" (1), "r" (x) : "memory");
|
asm volatile ("" : "=r" (ret) : "0" (1), "r" (x) : "memory");
|
return ret;
|
return ret;
|
}
|
}
|
|
|
void
|
void
|
xx1 (C13 x)
|
xx1 (C13 x)
|
{
|
{
|
asm volatile ("" : : "r" (&x) : "memory");
|
asm volatile ("" : : "r" (&x) : "memory");
|
if (tthrow)
|
if (tthrow)
|
throw 6;
|
throw 6;
|
}
|
}
|
|
|
void
|
void
|
xx3 (const C7 *x)
|
xx3 (const C7 *x)
|
{
|
{
|
if (x)
|
if (x)
|
abort ();
|
abort ();
|
}
|
}
|
|
|
void
|
void
|
xx7 ()
|
xx7 ()
|
{
|
{
|
asm volatile ("" : : : "memory");
|
asm volatile ("" : : : "memory");
|
}
|
}
|
|
|
struct C5
|
struct C5
|
{
|
{
|
C13 f2 (C3 &v1, const void *v2, C8 *v6);
|
C13 f2 (C3 &v1, const void *v2, C8 *v6);
|
C7 *m2[2];
|
C7 *m2[2];
|
long m1[2];
|
long m1[2];
|
};
|
};
|
|
|
C13
|
C13
|
C5::f2 (C3 &v1, const void *v2, C8 *v6)
|
C5::f2 (C3 &v1, const void *v2, C8 *v6)
|
{
|
{
|
C13 v13 = xx9 ();
|
C13 v13 = xx9 ();
|
C2 &v9 = xx10 ();
|
C2 &v9 = xx10 ();
|
for (long i = 1; i < 2; i++)
|
for (long i = 1; i < 2; i++)
|
xx3 (m2[i]);
|
xx3 (m2[i]);
|
const C3 &ld = xx5 ();
|
const C3 &ld = xx5 ();
|
xx7 ();
|
xx7 ();
|
if (xx2 ())
|
if (xx2 ())
|
throw "";
|
throw "";
|
xx4 ();
|
xx4 ();
|
C3 &si = xx12 ();
|
C3 &si = xx12 ();
|
for (long i = 0; i < xx16 (v2); ++i)
|
for (long i = 0; i < xx16 (v2); ++i)
|
{
|
{
|
C13 sk (new C1 (xx5 (), ld, xx5 (), xx4 ()));
|
C13 sk (new C1 (xx5 (), ld, xx5 (), xx4 ()));
|
xx15 (si, sk);
|
xx15 (si, sk);
|
}
|
}
|
long v4 = xx13 ();
|
long v4 = xx13 ();
|
for (long i = v4 - 1; i >= 0; --i)
|
for (long i = v4 - 1; i >= 0; --i)
|
m1[i] = i;
|
m1[i] = i;
|
bool v8 = xx2 ();
|
bool v8 = xx2 ();
|
for (long i = 0; i < 2 && !xx14 (); i++)
|
for (long i = 0; i < 2 && !xx14 (); i++)
|
{
|
{
|
v6[i].f1 (v9, 0, __null, v1, __null, v8);
|
v6[i].f1 (v9, 0, __null, v1, __null, v8);
|
if (v8)
|
if (v8)
|
xx1 (v6[i].f3 ());
|
xx1 (v6[i].f3 ());
|
}
|
}
|
return v13;
|
return v13;
|
}
|
}
|
|
|
int
|
int
|
main (void)
|
main (void)
|
{
|
{
|
C5 c5 = { { __null, __null }, { 0, 0 } };
|
C5 c5 = { { __null, __null }, { 0, 0 } };
|
bool seen = false;
|
bool seen = false;
|
try
|
try
|
{
|
{
|
c5.f2 (xx12 (), __null, __null);
|
c5.f2 (xx12 (), __null, __null);
|
}
|
}
|
catch (int n)
|
catch (int n)
|
{
|
{
|
if (n != 24)
|
if (n != 24)
|
abort ();
|
abort ();
|
seen = true;
|
seen = true;
|
}
|
}
|
if (!seen)
|
if (!seen)
|
abort ();
|
abort ();
|
}
|
}
|
|
|