/* { dg-require-effective-target freorder } */
|
/* { dg-require-effective-target freorder } */
|
/* { dg-options "-O2 -freorder-blocks-and-partition" } */
|
/* { dg-options "-O2 -freorder-blocks-and-partition" } */
|
|
|
struct A { A () __attribute__((noinline)); ~A () __attribute__((noinline)); };
|
struct A { A () __attribute__((noinline)); ~A () __attribute__((noinline)); };
|
A::A () { asm volatile ("" : : : "memory"); }
|
A::A () { asm volatile ("" : : : "memory"); }
|
A::~A () { asm volatile ("" : : : "memory"); }
|
A::~A () { asm volatile ("" : : : "memory"); }
|
|
|
int bar () __attribute__((noinline));
|
int bar () __attribute__((noinline));
|
void foo () __attribute__((noinline));
|
void foo () __attribute__((noinline));
|
|
|
volatile int k, l;
|
volatile int k, l;
|
|
|
int bar (int i)
|
int bar (int i)
|
{
|
{
|
void *p = __builtin_alloca (i);
|
void *p = __builtin_alloca (i);
|
asm volatile ("" : : "r" (i), "r" (p) : "memory");
|
asm volatile ("" : : "r" (i), "r" (p) : "memory");
|
if (k) throw 6;
|
if (k) throw 6;
|
return ++l;
|
return ++l;
|
}
|
}
|
|
|
void foo ()
|
void foo ()
|
{
|
{
|
A a;
|
A a;
|
try {
|
try {
|
A b;
|
A b;
|
int i = bar (5);
|
int i = bar (5);
|
try { throw 6; } catch (int) {}
|
try { throw 6; } catch (int) {}
|
if (__builtin_expect (i < 4500, 0)) {
|
if (__builtin_expect (i < 4500, 0)) {
|
bar (7);
|
bar (7);
|
try { bar (8); } catch (long) {}
|
try { bar (8); } catch (long) {}
|
bar (10);
|
bar (10);
|
if (__builtin_expect (i < 0, 0)) {
|
if (__builtin_expect (i < 0, 0)) {
|
try { bar (12); } catch (...) {}
|
try { bar (12); } catch (...) {}
|
bar (16);
|
bar (16);
|
bar (122);
|
bar (122);
|
} else {
|
} else {
|
try { bar (bar (7)); } catch (int) {}
|
try { bar (bar (7)); } catch (int) {}
|
}
|
}
|
} else {
|
} else {
|
try { bar (bar (bar (9))); } catch (...) {}
|
try { bar (bar (bar (9))); } catch (...) {}
|
bar (5);
|
bar (5);
|
}
|
}
|
} catch (...) {
|
} catch (...) {
|
}
|
}
|
}
|
}
|
|
|
int
|
int
|
main ()
|
main ()
|
{
|
{
|
int i;
|
int i;
|
for (i = 0; i < 10000; i++)
|
for (i = 0; i < 10000; i++)
|
foo ();
|
foo ();
|
}
|
}
|
|
|