summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-3379.c
blob: c2ea476f07b674e8f22c685821869588ccd8983c (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-3368.c
   A bug in stm8 codegen affecting tail-call optimization of calls to functions taing a single 8-bit parameter from functions that put exactly 1 byte of local variables on the stack.
 */

#include <testfwk.h>

#include <stdbool.h>

volatile unsigned char a;

static inline void ta(void)
{
    a |= 0x1;
}

static void sub_func(bool my_sub_flag)
{
    ASSERT (my_sub_flag);
}

static void sdcc42_bug(bool my_flag)
{
    if (my_flag)
        ta();
    else
        ta();

    sub_func(true);
}

void testBug(void)
{
	sdcc42_bug(false);
}