OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.dg/] [init/] [init-ref1.C] - Diff between revs 301 and 338

Only display areas with differences | Details | Blame | View Log

Rev 301 Rev 338
// 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);
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.