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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.mike/] [eh1.C] - Blame information for rev 699

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do assemble  }
2
// { dg-options "-fexceptions -O -S" }
3
 
4
extern "C" int printf (const char *, ...);
5
extern "C" int atoi (const char *);
6
extern "C" void exit (int);
7
 
8
struct Exception
9
 {
10
     int v;
11
     Exception(int i) { v = i; };
12
 };
13
 
14
 void inc(int &i)
15
 {
16
     try {
17
         if (i == 0)
18
             throw Exception(i);
19
         else
20
             i++;
21
     }
22
     catch (Exception v) {
23
         i = v.v;
24
     }
25
 }
26
 
27
main (int argc, const char *argv[])
28
{
29
  if (argc != 2)
30
    {
31
      printf ("usage: a.out \n");
32
      exit (1);
33
    }
34
  int count = atoi (argv[1]);
35
  inc (count);
36
  printf ("success\n");
37
  exit (0);
38
}

powered by: WebSVN 2.1.0

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