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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [torture/] [pr49394.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do run }
2
// { dg-options "-fipa-pta -fnon-call-exceptions" }
3
 
4
struct Mutex
5
{
6
  bool locked;
7
  ~Mutex ()
8
  {
9
    if (locked)
10
      throw 0;
11
  }
12
  void lock ()
13
  {
14
    locked = true;
15
  }
16
  void unlock ()
17
  {
18
    if (!locked)
19
      throw 0;
20
    locked = false;
21
  }
22
};
23
 
24
struct lock_guard
25
{
26
  Mutex *m;
27
  lock_guard (Mutex *m) : m(m)
28
  {
29
  }
30
  ~lock_guard ()
31
  {
32
    m->unlock ();
33
  }
34
};
35
 
36
int
37
main ()
38
{
39
  Mutex m;
40
  m.lock ();
41
  try
42
  {
43
    lock_guard l (&m);
44
  }
45
  catch ( ...)
46
  {
47
    __builtin_abort ();
48
  }
49
  return 0;
50
}

powered by: WebSVN 2.1.0

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