OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [torture/] [pr48542.c] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do run } */
2
/* The return-address was clobbered.  */
3
#include <stdlib.h>
4
#include <setjmp.h>
5
 
6
jmp_buf env;
7
extern void sub(void);
8
extern void sub3(void);
9
int called;
10
__attribute__ ((__noinline__))
11
int sjtest()
12
{
13
  int i;
14
  if (setjmp(env))
15
    return 99;
16
 
17
  for (i = 0; i < 10; i++)
18
    sub();
19
 
20
  longjmp(env, 1);
21
}
22
 
23
__attribute__ ((__noinline__))
24
void sub(void)
25
{
26
  called++;
27
}
28
 
29
int called3;
30
__attribute__ ((__noinline__))
31
int sjtest3()
32
{
33
  int i;
34
  if (setjmp(env))
35
    return 42;
36
 
37
  for (i = 0; i < 10; i++)
38
    sub3();
39
  return 0;
40
}
41
 
42
__attribute__ ((__noinline__))
43
void sub3(void)
44
{
45
  called3++;
46
  if (called3 == 10)
47
    longjmp (env, 1);
48
}
49
 
50
int main(void)
51
{
52
  if (sjtest() != 99 || called != 10)
53
    abort();
54
  if (sjtest3() != 42 || called3 != 10)
55
    abort();
56
  exit (0);
57
}

powered by: WebSVN 2.1.0

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