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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [opt/] [eh4.C] - Blame information for rev 749

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

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do run }
2
// { dg-options "-O3" }
3
 
4
// Make sure that the call to terminate within F2 is not eliminated
5
// by incorrect MUST_NOT_THROW optimization.  Note that we expect F1
6
// to be inlined into F2 in order to expose this case.
7
 
8
#include 
9
#include 
10
 
11
static volatile int zero = 0;
12
 
13
// Note that we need F0 to not be marked nothrow, though we don't actually
14
// want a throw to happen at runtime here.  The noinline tag is merely to
15
// make sure the assembly in F0 is not unnecessarily complex.
16
static void __attribute__((noinline)) f0()
17
{
18
  if (zero != 0)
19
    throw 0;
20
}
21
 
22
struct S1
23
{
24
  S1() { }
25
  ~S1() { f0(); }
26
};
27
 
28
static void f1()
29
{
30
  S1 s1;
31
  throw 1;
32
}
33
 
34
struct S2
35
{
36
  S2() { }
37
  ~S2() { f1(); }
38
};
39
 
40
static void __attribute__((noinline)) f2()
41
{
42
  S2 s2;
43
  throw 2;
44
}
45
 
46
static void pass()
47
{
48
  exit (0);
49
}
50
 
51
int main()
52
{
53
  std::set_terminate (pass);
54
  try {
55
    f2();
56
  } catch (...) {
57
  }
58
  abort ();
59
}

powered by: WebSVN 2.1.0

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