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 |
// Submitted by Erik Rozendaal
|
// Submitted by Erik Rozendaal
|
// Test case for GNATS bug 787.
|
// Test case for GNATS bug 787.
|
// { dg-do run }
|
// { dg-do run }
|
|
|
#include
|
#include
|
#include
|
#include
|
|
|
static int calls;
|
static int calls;
|
|
|
int &foo (int &arg)
|
int &foo (int &arg)
|
{
|
{
|
calls++;
|
calls++;
|
arg=0;
|
arg=0;
|
return arg;
|
return arg;
|
}
|
}
|
|
|
int &identity (int &x)
|
int &identity (int &x)
|
{
|
{
|
return x;
|
return x;
|
}
|
}
|
|
|
int main()
|
int main()
|
{
|
{
|
int a;
|
int a;
|
|
|
calls = 0;
|
calls = 0;
|
int &b = ++foo (a);
|
int &b = ++foo (a);
|
if (calls > 1)
|
if (calls > 1)
|
abort ();
|
abort ();
|
if (&a != &b)
|
if (&a != &b)
|
abort ();
|
abort ();
|
if (a != 1)
|
if (a != 1)
|
abort ();
|
abort ();
|
|
|
calls = 0;
|
calls = 0;
|
int &c = ++identity (++foo (a));
|
int &c = ++identity (++foo (a));
|
if (calls > 1)
|
if (calls > 1)
|
abort ();
|
abort ();
|
if (&a != &c)
|
if (&a != &c)
|
abort ();
|
abort ();
|
if (a != 2)
|
if (a != 2)
|
abort ();
|
abort ();
|
|
|
exit (0);
|
exit (0);
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.