summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-3282.c
blob: 6e07d6fd3e716ea2349fd8e60cca4456eada2882 (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
41
42
43
44
45
/*
   bug-3282.c. On stm8, the register allocator decided that one byte of a stack-pointer-relative address
   should be rematerialized, and the other stored in a register. stm8 code generation can't handle that yet.
 */

#include <testfwk.h>

void g1(void);

void f1(void)
{
	_Bool i;
	if (&i)
		g1();
}

void g2(void);

void f2(void)
{
	_Bool i;
	_Bool *volatile p = &i;
	if (p)
		g2();
}

void
testBug (void)
{
	f1();
	f2();
}

int g;

void g1(void)
{
	ASSERT(++g == 1);
}

void g2(void)
{
	ASSERT(++g == 2);
}