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

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

// { dg-do run }

// Copyright (C) 2002 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 12 Oct 2002 <nathan@codesourcery.com>

// From WindRiver SPR 80797
// We were inadvertently SAVE_EXPRing volatile arrays during delete[]

struct A
{
  A *ptr;
  static int ok;
  
  A () {ptr = this;}
  ~A () {ok = ptr == this;}
};
int A::ok = -1;

struct B
{
  B *ptr;
  static int ok;
  
  B () {ptr = this;}
  ~B () {ok = ptr == this;}
};
int B::ok = -1;

struct C
{
  A volatile a;
  B volatile b[1];

  C ();
};

C::C ()
{
  throw 1;
}

int main ()
{
  try
    {
      C c;
    }
  catch (...)
    {
      if (A::ok != 1)
        return 1;
      if (B::ok != 1)
        return 2;
      return 0;
    }
  return 3;
}

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.