struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / z80n-push-nn.c
blob1d999518a347a48edff64519c5ee127da7ca3ff4
1 /* z80n-push-nn
2 Invalid relocation of Z80N PUSH nn instruction value
3 */
4 #include <testfwk.h>
5 #include <string.h>
7 int x;
8 typedef void* (*memcpy_p)(void *d, const void *s, size_t c);
10 #ifdef __SDCC_z80n
11 int f(void) __naked
13 __asm
14 push #0x1234
15 push #_x
16 pop hl
17 pop de
18 ld a, (hl)
19 inc hl
20 ld h, (hl)
21 ld l, a
22 add hl, de
23 ex de, hl
24 ret
26 .db #>_x, #<_x
27 .dw #_x
28 __endasm;
30 memcpy_p g(void) __naked
32 __asm
33 push #_memcpy
34 pop de
35 ret
36 __endasm;
38 #else
39 int f(void)
41 return x + 0x1234;
43 memcpy_p g(void)
45 return &memcpy;
47 #endif
49 void testBug3032(void)
51 x = 0x7531;
52 ASSERT (f() == 0x8765);
53 ASSERT (g() == &memcpy);