summaryrefslogtreecommitdiffstats
path: root/tests/tc900_bugs/direct-lstack-alloc.awl
blob: 37d169edb198b29d4878a07eb7c7c85ddd1ed7db (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
FUNCTION FC 20 : VOID
VAR_INPUT
	VAR1	: BYTE;
	VAR2	: BYTE;
END_VAR
BEGIN
	// Check whether VAR1 (VLB 0) was clobbered.
	L		#VAR1
	__ASSERT==	__ACCU 1,	1
END_FUNCTION


FUNCTION FC 10 : VOID
BEGIN
	L		1
	T		LB 0	// This directly allocates LB 0
	CALL	FC 20 (
		VAR1	:= LB 0,

		// This 'B#16#0' immediate implicitly allocates
		// space on the L stack.
		// It should not overwrite the direct LB 0 allocation.
		VAR2	:= B#16#0,
	)
END_FUNCTION


FUNCTION FC 2 : VOID
VAR_INPUT
	BVAR1	: BOOL;
	BVAR2	: BOOL;
END_VAR
BEGIN
	// Check whether BVAR1 (VLB 0) was clobbered.
	__STWRST
	U		#BVAR1
	__ASSERT==	__STW VKE,	1
	__STWRST
END_FUNCTION


FUNCTION FC 1 : VOID
BEGIN
	L		1
	T		LB 0	// This directly allocates LB 0
	CALL	FC 2 (
		BVAR1	:= L 0.0,

		// This 'FALSE' immediate implicitly allocates
		// space on the L stack.
		// It should not overwrite the direct LB 0 allocation.
		BVAR2	:= FALSE,
	)
END_FUNCTION


ORGANIZATION_BLOCK OB 1
BEGIN
	CALL	FC 1
	CALL	FC 10

	CALL SFC 46 // STOP CPU
END_ORGANIZATION_BLOCK
bues.ch cgit interface