repo.or.cz
/
sdcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
struct / union in initializer, RFE #901.
[sdcc.git]
/
sdcc
/
support
/
regression
/
tests
/
bug3531687.c
blob
6a01003630248bf684ac9d54800016180d5d0e72
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
12
int
f
(
char
a
,
char
flag
)
13
{
14
if
(
a
== (
flag
?
1
:
0
))
15
return
0
;
16
return
1
;
17
}
18
19
bool
g
(
char
a
,
bool
b
)
20
{
21
return
(
a
>
b
);
22
}
23
24
void
25
testBug
(
void
)
26
{
27
ASSERT
(
f
(
2
,
1
));
28
ASSERT
(
g
(
2
,
1
));
29
}