URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 305 |
Rev 384 |
// { dg-do run }
|
// { dg-do run }
|
// { dg-options "-O2" }
|
// { dg-options "-O2" }
|
// Origin: suckfish@ihug.co.nz
|
// Origin: suckfish@ihug.co.nz
|
|
|
// DECLARATIONS
|
// DECLARATIONS
|
|
|
struct Record {
|
struct Record {
|
Record (int bb) :
|
Record (int bb) :
|
b (bb)
|
b (bb)
|
{ }
|
{ }
|
int extra; // Having an extra member in record is crucial.
|
int extra; // Having an extra member in record is crucial.
|
int b;
|
int b;
|
};
|
};
|
|
|
struct Container {
|
struct Container {
|
Record record;
|
Record record;
|
// The const on the next line is crucial.
|
// The const on the next line is crucial.
|
Container ( const Record b) : record(b) {}
|
Container ( const Record b) : record(b) {}
|
};
|
};
|
|
|
|
|
// TEST FOR CORRECT BEHAVIOR
|
// TEST FOR CORRECT BEHAVIOR
|
|
|
int myArray[3];
|
int myArray[3];
|
int * intp = myArray;
|
int * intp = myArray;
|
|
|
void use_pair (const Container & c)
|
void use_pair (const Container & c)
|
{
|
{
|
*intp++ = c.record.b;
|
*intp++ = c.record.b;
|
}
|
}
|
|
|
extern "C" int printf (const char *,...);
|
extern "C" int printf (const char *,...);
|
|
|
int main()
|
int main()
|
{
|
{
|
use_pair (Container (1234));
|
use_pair (Container (1234));
|
|
|
if (myArray[0] != 1234)
|
if (myArray[0] != 1234)
|
return 1;
|
return 1;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.