URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 298 |
Rev 338 |
/* { dg-do run } */
|
/* { dg-do run } */
|
/* { dg-options "" } */
|
/* { dg-options "" } */
|
/* Verify that the cleanup handler receives the proper contents
|
/* Verify that the cleanup handler receives the proper contents
|
of the variable. */
|
of the variable. */
|
|
|
extern void exit(int);
|
extern void exit(int);
|
extern void abort(void);
|
extern void abort(void);
|
|
|
static int expected;
|
static int expected;
|
|
|
static void
|
static void
|
handler(int *p)
|
handler(int *p)
|
{
|
{
|
if (*p != expected)
|
if (*p != expected)
|
abort ();
|
abort ();
|
}
|
}
|
|
|
static void __attribute__((noinline))
|
static void __attribute__((noinline))
|
bar(void)
|
bar(void)
|
{
|
{
|
}
|
}
|
|
|
static void doit(int x, int y)
|
static void doit(int x, int y)
|
{
|
{
|
int r __attribute__((cleanup (handler)));
|
int r __attribute__((cleanup (handler)));
|
if (x < y)
|
if (x < y)
|
{
|
{
|
r = 0;
|
r = 0;
|
return;
|
return;
|
}
|
}
|
|
|
bar();
|
bar();
|
r = x + y;
|
r = x + y;
|
}
|
}
|
|
|
int main()
|
int main()
|
{
|
{
|
expected = 0;
|
expected = 0;
|
doit (1, 2);
|
doit (1, 2);
|
|
|
expected = 3;
|
expected = 3;
|
doit (2, 1);
|
doit (2, 1);
|
|
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.