summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-2716.c
blob: eef1bcf013b0c811915c02e0e7284745d1c48989 (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
36
37
38
39
40
/* bug-2716.c
 */

#include <testfwk.h>

struct s
{
	unsigned int i;
};

struct s *p;

int i, j;

int g(void)
{
	ASSERT(0);

	return(0);
}

int f(void)
{
	int a = i;
	int b = j;

	if(p->i & 4) /* This bit test used the wrong byte of p->i*/
		g();

	return(a + b);
}

void testBug(void)
{
	struct s s;
	s.i = 0xff00;
	p = &s;
	f();
}