blob: baafc50e639622507e469bdb3c6b0817673bc1c2 (
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
30
31
32
33
34
35
|
/*
bug-2503
*/
#include <testfwk.h>
/* Make sure side-effects are preserved when optimizing */
/* conditional tests. */
unsigned int x;
unsigned int test1(void)
{
unsigned int a=0;
if ((a=0x55) >= 0)
x++;
return a;
}
unsigned int test2(void)
{
return x++;
}
void
testBug(void)
{
x = 0;
ASSERT(test1() == 0x55);
ASSERT(x == 1);
ASSERT(test1() == test1());
ASSERT(x == 3);
ASSERT((test2() - test2()) != 0);
ASSERT(x == 5);
}
|