aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/ifelse-2.c
blob: 0210fcfa4b6c52530e8486cd0984567a1ae6be07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
{ dg-do run }
{ dg-options "-O2" }
*/

extern void abort (void);

enum Status
{
  P_ON_LOWER = -4,
  P_ON_UPPER = -2,
  P_FREE = -1
};

void
foo (enum Status *stat, double newUpper, double lower, double max)
{
  if (newUpper >= max)
    *stat = P_FREE;
  else if (newUpper == lower)
    *stat = P_ON_LOWER;
}

int
main ()
{
  enum Status stat = P_ON_UPPER;

  foo (&stat, 5.0, -10.0, 10.0);

  if (stat != P_ON_UPPER)
    abort ();
  return 0;
}