re PR c++/31806 (miscompilation with -fschedule-insns2 -fno-threadsafe-statics)

2007-06-14  Dirk Mueller  <dmueller@suse.de>

       PR c++/31806
       * g++.dg/opt/static6.C: New testcase.

From-SVN: r125726
This commit is contained in:
Dirk Mueller 2007-06-14 23:12:25 +00:00 committed by Dirk Mueller
parent 5eafdd32da
commit bf37bd8885
2 changed files with 40 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2007-06-14 Dirk Mueller <dmueller@suse.de>
PR c++/31806
* g++.dg/opt/static6.C: New testcase.
2007-06-14 Geoff Keating <geoffk@apple.com>
* g++.dg/ext/visibility/overload-1.C: New.

View File

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