URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 157 |
Rev 223 |
/* Check that setjmp and longjmp stand a chance to work; that the used machine
|
/* Check that setjmp and longjmp stand a chance to work; that the used machine
|
primitives work in the simulator. */
|
primitives work in the simulator. */
|
|
|
#include <stdio.h>
|
#include <stdio.h>
|
#include <setjmp.h>
|
#include <setjmp.h>
|
#include <stdlib.h>
|
#include <stdlib.h>
|
|
|
extern void f (void);
|
extern void f (void);
|
|
|
int ok = 0;
|
int ok = 0;
|
jmp_buf b;
|
jmp_buf b;
|
|
|
int
|
int
|
main ()
|
main ()
|
{
|
{
|
int ret = setjmp (b);
|
int ret = setjmp (b);
|
|
|
if (ret == 42)
|
if (ret == 42)
|
ok = 100;
|
ok = 100;
|
else if (ret == 0)
|
else if (ret == 0)
|
f ();
|
f ();
|
|
|
if (ok == 100)
|
if (ok == 100)
|
printf ("pass\n");
|
printf ("pass\n");
|
else
|
else
|
printf ("fail\n");
|
printf ("fail\n");
|
exit (0);
|
exit (0);
|
}
|
}
|
|
|
void
|
void
|
f (void)
|
f (void)
|
{
|
{
|
longjmp (b, 42);
|
longjmp (b, 42);
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.