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] - Rev 774

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

// { dg-do run }
// { dg-options "-fipa-pta -fnon-call-exceptions" }

struct Mutex
{
  bool locked;
  ~Mutex ()
  {
    if (locked)
      throw 0;
  }
  void lock ()
  {
    locked = true;
  }
  void unlock ()
  {
    if (!locked)
      throw 0;
    locked = false;
  }
};

struct lock_guard
{
  Mutex *m;
  lock_guard (Mutex *m) : m(m)
  {
  }
  ~lock_guard ()
  {
    m->unlock ();
  }
};

int
main ()
{
  Mutex m;
  m.lock ();
  try
  {
    lock_guard l (&m);
  }
  catch ( ...)
  {
    __builtin_abort ();
  }
  return 0;
}

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

powered by: WebSVN 2.1.0

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