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++.dg/] [opt/] [static6.C] - Diff between revs 301 and 338

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

Rev 301 Rev 338
// PR c++/31806
// PR c++/31806
// { dg-do run }
// { dg-do run }
// { dg-options "-O2 -fno-inline -fno-threadsafe-statics" }
// { dg-options "-O2 -fno-inline -fno-threadsafe-statics" }
extern "C" void abort(void);
extern "C" void abort(void);
struct A
struct A
{
{
    void *d;
    void *d;
};
};
static const A& staticA()
static const A& staticA()
{
{
    static A s_static;
    static A s_static;
    return s_static;
    return s_static;
}
}
void assert_failed()
void assert_failed()
{
{
    abort();
    abort();
}
}
A testMethod()
A testMethod()
{
{
    static const A& s = staticA( );
    static const A& s = staticA( );
    if (&s == 0)
    if (&s == 0)
        assert_failed();
        assert_failed();
    return s;
    return s;
}
}
int main()
int main()
{
{
    testMethod();
    testMethod();
    return 0;
    return 0;
}
}
 
 

powered by: WebSVN 2.1.0

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