summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-2912.c
blob: 7468241dd25591b20318c672b3f2cbc75e56c96a (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
/*
   bug-2912.c a bug in handling non-spilt register parameters in __z88dk_fastcall functions.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma disable_warning 85
#endif

#if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // lack of memory
float y, z;

float m32_sinf (float x) __z88dk_fastcall
{
    y = x;
}

float m32_cosf (float x) __z88dk_fastcall
{
    z = y;
}

float m32_tanf (float x) __z88dk_fastcall
{
    return m32_sinf(x)/m32_cosf(x);
}
#endif

void testBug(void)
{
#if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // lack of memory
    volatile float x = 23.0f;

    m32_tanf(x);

    ASSERT(y == x);
    ASSERT(z == x);
#endif
}