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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.brendan/] [eh1.C] - Diff between revs 305 and 338

Only display areas with differences | Details | Blame | View Log

Rev 305 Rev 338
// { dg-do run  }
// { dg-do run  }
// { dg-options "-O" }
// { dg-options "-O" }
// PRMS Id: 10776
// PRMS Id: 10776
extern "C" int printf (const char *, ...);
extern "C" int printf (const char *, ...);
class Foo
class Foo
{
{
  public:
  public:
    Foo(int n) : n_(n) { }
    Foo(int n) : n_(n) { }
    int f() { return n_; }
    int f() { return n_; }
    int badTest();
    int badTest();
    int goodTest();
    int goodTest();
  private:
  private:
    int n_;
    int n_;
};
};
int Foo::badTest()
int Foo::badTest()
{
{
    try {
    try {
        throw int(99);
        throw int(99);
    }
    }
    catch (int &i) {
    catch (int &i) {
        n_ = 16;
        n_ = 16;
    }
    }
    return n_;
    return n_;
        // On the sparc, the return will use a ld [%l0],%i0 instruction.
        // On the sparc, the return will use a ld [%l0],%i0 instruction.
        // However %l0 was clobbered at the end of the catch block.  It was
        // However %l0 was clobbered at the end of the catch block.  It was
        // used to do an indirect call.
        // used to do an indirect call.
}
}
int Foo::goodTest()
int Foo::goodTest()
{
{
    int n;
    int n;
    try {
    try {
        throw int(99);
        throw int(99);
    }
    }
    catch (int &i) {
    catch (int &i) {
        n = 16;
        n = 16;
    }
    }
    return n_;
    return n_;
        // The return will use a ld [%l2],%i0 instruction.  Since %l2
        // The return will use a ld [%l2],%i0 instruction.  Since %l2
        // contains the "this" pointer this works.
        // contains the "this" pointer this works.
}
}
int main()
int main()
{
{
    Foo foo(5);
    Foo foo(5);
    foo.goodTest();
    foo.goodTest();
    foo.badTest();
    foo.badTest();
    // the badTest will have failed
    // the badTest will have failed
    printf ("PASS\n");
    printf ("PASS\n");
}
}
 
 

powered by: WebSVN 2.1.0

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