1 /*
2   bug3531687.c
3 
4   The bug resulted in wrong comparisons of char to bool, casting the char operand to bool.
5 */
6 
7 #include <testfwk.h>
8 #include <stdbool.h>
9 
10 #pragma std_c99
11 
f(char a,char flag)12 int f(char a, char flag)
13 {
14   if (a == (flag ? 1 : 0))
15     return 0;
16   return 1;
17 }
18 
g(char a,bool b)19 bool g(char a, bool b)
20 {
21   return (a > b);
22 }
23 
24 void
testBug(void)25 testBug(void)
26 {
27   ASSERT(f(2, 1));
28   ASSERT(g(2, 1));
29 }
30