OSDN Git Service

2012-04-03 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / ifelse-2.c
1 /*
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 }