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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [ifelse-2.c] - Blame information for rev 774

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

Line No. Rev Author Line
1 689 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.