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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [cleanup-4.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do run } */
2
/* { dg-options "" } */
3
/* Verify cleanup execution on non-trivial exit from a block.  */
4
 
5
extern void exit(int);
6
extern void abort(void);
7
 
8
static int counter;
9
 
10
static void
11
handler(int *p)
12
{
13
  counter += *p;
14
}
15
 
16
static void __attribute__((noinline))
17
bar(void)
18
{
19
}
20
 
21
static void doit(int n, int n2)
22
{
23
  int i;
24
  for (i = 0; i < n; ++i)
25
    {
26
      int dummy __attribute__((cleanup (handler))) = i;
27
      if (i == n2)
28
        break;
29
      bar();
30
    }
31
}
32
 
33
int main()
34
{
35
  doit (10, 6);
36
  if (counter != 0 + 1 + 2 + 3 + 4 + 5 + 6)
37
    abort ();
38
  return 0;
39
}

powered by: WebSVN 2.1.0

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