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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [ifelse-2.c] - Diff between revs 816 and 826

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

Rev 816 Rev 826
/*
/*
{ dg-do run }
{ dg-do run }
{ dg-options "-O2" }
{ dg-options "-O2" }
*/
*/
 
 
extern void abort (void);
extern void abort (void);
 
 
enum Status
enum Status
{
{
  P_ON_LOWER = -4,
  P_ON_LOWER = -4,
  P_ON_UPPER = -2,
  P_ON_UPPER = -2,
  P_FREE = -1
  P_FREE = -1
};
};
 
 
void
void
foo (enum Status *stat, double newUpper, double lower, double max)
foo (enum Status *stat, double newUpper, double lower, double max)
{
{
  if (newUpper >= max)
  if (newUpper >= max)
    *stat = P_FREE;
    *stat = P_FREE;
  else if (newUpper == lower)
  else if (newUpper == lower)
    *stat = P_ON_LOWER;
    *stat = P_ON_LOWER;
}
}
 
 
int
int
main ()
main ()
{
{
  enum Status stat = P_ON_UPPER;
  enum Status stat = P_ON_UPPER;
 
 
  foo (&stat, 5.0, -10.0, 10.0);
  foo (&stat, 5.0, -10.0, 10.0);
 
 
  if (stat != P_ON_UPPER)
  if (stat != P_ON_UPPER)
    abort ();
    abort ();
  return 0;
  return 0;
}
}
 
 

powered by: WebSVN 2.1.0

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