OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [ifelse-2.c] - Blame information for rev 404

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/*
2
{ dg-do run }
3
{ dg-options "-O2" }
4
*/
5
 
6
extern void abort (void);
7
 
8
enum Status
9
{
10
  P_ON_LOWER = -4,
11
  P_ON_UPPER = -2,
12
  P_FREE = -1
13
};
14
 
15
void
16
foo (enum Status *stat, double newUpper, double lower, double max)
17
{
18
  if (newUpper >= max)
19
    *stat = P_FREE;
20
  else if (newUpper == lower)
21
    *stat = P_ON_LOWER;
22
}
23
 
24
int
25
main ()
26
{
27
  enum Status stat = P_ON_UPPER;
28
 
29
  foo (&stat, 5.0, -10.0, 10.0);
30
 
31
  if (stat != P_ON_UPPER)
32
    abort ();
33
  return 0;
34
}

powered by: WebSVN 2.1.0

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