URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 301 |
Rev 338 |
// PR c++/20416. We correctly constructed the temporary S in foo(),
|
// PR c++/20416. We correctly constructed the temporary S in foo(),
|
// but incorrectly destroyed it every time foo() was called.
|
// but incorrectly destroyed it every time foo() was called.
|
// When using a wrapped target, there is no way to override the exit
|
// When using a wrapped target, there is no way to override the exit
|
// code after returning from main.
|
// code after returning from main.
|
// { dg-do run { target unwrapped } }
|
// { dg-do run { target unwrapped } }
|
extern "C" void abort (void);
|
extern "C" void abort (void);
|
extern "C" void _exit (int);
|
extern "C" void _exit (int);
|
|
|
int c, exiting;
|
int c, exiting;
|
struct S {
|
struct S {
|
S() { ++c; }
|
S() { ++c; }
|
S(const S &) { ++c; }
|
S(const S &) { ++c; }
|
~S()
|
~S()
|
{
|
{
|
if (!exiting) abort ();
|
if (!exiting) abort ();
|
_exit (0);
|
_exit (0);
|
}
|
}
|
};
|
};
|
void
|
void
|
foo (void)
|
foo (void)
|
{
|
{
|
static const S &s = S();
|
static const S &s = S();
|
}
|
}
|
int main ()
|
int main ()
|
{
|
{
|
if (c != 0)
|
if (c != 0)
|
abort ();
|
abort ();
|
foo ();
|
foo ();
|
foo ();
|
foo ();
|
if (c != 1)
|
if (c != 1)
|
abort ();
|
abort ();
|
exiting = 1;
|
exiting = 1;
|
return 1;
|
return 1;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.