URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
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;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.