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
/
bug-2503.c
blob
baafc50e639622507e469bdb3c6b0817673bc1c2
1
/*
2
bug-2503
3
*/
4
5
#include <testfwk.h>
6
7
/* Make sure side-effects are preserved when optimizing */
8
/* conditional tests. */
9
10
unsigned int
x
;
11
12
unsigned int
test1
(
void
)
13
{
14
unsigned int
a
=
0
;
15
if
((
a
=
0x55
) >=
0
)
16
x
++;
17
return
a
;
18
}
19
20
unsigned int
test2
(
void
)
21
{
22
return
x
++;
23
}
24
25
void
26
testBug
(
void
)
27
{
28
x
=
0
;
29
ASSERT
(
test1
() ==
0x55
);
30
ASSERT
(
x
==
1
);
31
ASSERT
(
test1
() ==
test1
());
32
ASSERT
(
x
==
3
);
33
ASSERT
((
test2
() -
test2
()) !=
0
);
34
ASSERT
(
x
==
5
);
35
}