URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 301 |
Rev 384 |
/* { dg-do run } */
|
/* { dg-do run } */
|
/* { dg-options "" } */
|
/* { dg-options "" } */
|
/* Verify cleanup execution on non-trivial exit from a block. */
|
/* Verify cleanup execution on non-trivial exit from a block. */
|
|
|
extern "C" void exit(int);
|
extern "C" void exit(int);
|
extern "C" void abort(void);
|
extern "C" void abort(void);
|
|
|
static int counter;
|
static int counter;
|
|
|
static void
|
static void
|
handler(int *p)
|
handler(int *p)
|
{
|
{
|
counter += *p;
|
counter += *p;
|
}
|
}
|
|
|
static void __attribute__((noinline))
|
static void __attribute__((noinline))
|
bar(void)
|
bar(void)
|
{
|
{
|
}
|
}
|
|
|
static void doit(int n, int n2)
|
static void doit(int n, int n2)
|
{
|
{
|
int i;
|
int i;
|
for (i = 0; i < n; ++i)
|
for (i = 0; i < n; ++i)
|
{
|
{
|
int dummy __attribute__((cleanup (handler))) = i;
|
int dummy __attribute__((cleanup (handler))) = i;
|
if (i == n2)
|
if (i == n2)
|
break;
|
break;
|
bar();
|
bar();
|
}
|
}
|
}
|
}
|
|
|
int main()
|
int main()
|
{
|
{
|
doit (10, 6);
|
doit (10, 6);
|
if (counter != 0 + 1 + 2 + 3 + 4 + 5 + 6)
|
if (counter != 0 + 1 + 2 + 3 + 4 + 5 + 6)
|
abort ();
|
abort ();
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.