URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 301 |
Rev 384 |
// { dg-do run }
|
// { dg-do run }
|
|
|
// Contributed by Nathan Sidwell 15 Dec 2003
|
// Contributed by Nathan Sidwell 15 Dec 2003
|
// Origin: Tasso Karkanis
|
// Origin: Tasso Karkanis
|
// PR c++/13387. Clobbered tail padding of base
|
// PR c++/13387. Clobbered tail padding of base
|
|
|
inline void *operator new (__SIZE_TYPE__, void *ptr)
|
inline void *operator new (__SIZE_TYPE__, void *ptr)
|
{
|
{
|
return ptr;
|
return ptr;
|
}
|
}
|
|
|
struct Base {
|
struct Base {
|
Base() : i(0), c(0) {}
|
Base() : i(0), c(0) {}
|
int i;
|
int i;
|
char c;
|
char c;
|
};
|
};
|
|
|
struct Sub : Base {
|
struct Sub : Base {
|
Sub () : d(0) {}
|
Sub () : d(0) {}
|
char d;
|
char d;
|
};
|
};
|
|
|
int main() {
|
int main() {
|
Sub sub;
|
Sub sub;
|
char base_alias[sizeof (Base)];
|
char base_alias[sizeof (Base)];
|
Base *base;
|
Base *base;
|
|
|
for (unsigned ix = sizeof base_alias; ix--;)
|
for (unsigned ix = sizeof base_alias; ix--;)
|
base_alias[ix] = 0x55;
|
base_alias[ix] = 0x55;
|
base = new (&base_alias) Base ();
|
base = new (&base_alias) Base ();
|
|
|
static_cast (sub) = *base;
|
static_cast (sub) = *base;
|
return sub.d;
|
return sub.d;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.