OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gdb-6.8/] [pre-binutils-2.20.1-sync/] [sim/] [testsuite/] [sim/] [cris/] [c/] [sjlj.c] - Diff between revs 157 and 223

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);
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.