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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [init/] [ctor1.C] - Blame information for rev 774

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

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do run }
2
 
3
// Copyright (C) 2002 Free Software Foundation, Inc.
4
// Contributed by Nathan Sidwell 12 Oct 2002 
5
 
6
// From WindRiver SPR 80797
7
// We were inadvertently SAVE_EXPRing volatile arrays during delete[]
8
 
9
struct A
10
{
11
  A *ptr;
12
  static int ok;
13
 
14
  A () {ptr = this;}
15
  ~A () {ok = ptr == this;}
16
};
17
int A::ok = -1;
18
 
19
struct B
20
{
21
  B *ptr;
22
  static int ok;
23
 
24
  B () {ptr = this;}
25
  ~B () {ok = ptr == this;}
26
};
27
int B::ok = -1;
28
 
29
struct C
30
{
31
  A volatile a;
32
  B volatile b[1];
33
 
34
  C ();
35
};
36
 
37
C::C ()
38
{
39
  throw 1;
40
}
41
 
42
int main ()
43
{
44
  try
45
    {
46
      C c;
47
    }
48
  catch (...)
49
    {
50
      if (A::ok != 1)
51
        return 1;
52
      if (B::ok != 1)
53
        return 2;
54
      return 0;
55
    }
56
  return 3;
57
}

powered by: WebSVN 2.1.0

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