summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug3531687.c
blob: 6a01003630248bf684ac9d54800016180d5d0e72 (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
/*
  bug3531687.c

  The bug resulted in wrong comparisons of char to bool, casting the char operand to bool.
*/

#include <testfwk.h>
#include <stdbool.h>

#pragma std_c99

int f(char a, char flag)
{
  if (a == (flag ? 1 : 0))
    return 0;
  return 1;
}

bool g(char a, bool b)
{
  return (a > b);
}

void
testBug(void)
{
  ASSERT(f(2, 1));
  ASSERT(g(2, 1));
}