Fix handling of pre-C2X function declarators without prototype, RFE #776.
[sdcc.git] / sdcc / support / regression / tests / bug-3169.c
blob5e1da592837720974b41707da5d65121817f04d0
1 /*
2 bug-3169.c
3 A bug in z80 pointer write code generation handling of non-dead register pair de when using --reserve-regs-iy.
4 */
6 #include <testfwk.h>
8 #pragma disable_warning 283
10 typedef unsigned char uint8_t;
11 typedef unsigned int uint16_t;
12 typedef unsigned char bool;
14 typedef struct _Struct {
15 uint8_t abyte1;
16 uint8_t abyte2;
17 uint16_t aint;
18 } Struct;
20 Struct storage;
22 uint16_t srcInt;
23 bool flag;
25 extern void fn1(const Struct*) __z88dk_fastcall;
27 void f() {
29 storage.abyte1 = 1;
30 storage.abyte2 = 10;
32 if (flag) {
33 storage.aint = srcInt;
34 fn1(&storage);
36 return;
39 storage.aint = 1;
40 fn1(&storage);
43 void fn1(const Struct *sp) __z88dk_fastcall
45 ASSERT(sp == &storage);
48 void
49 testBug(void)
51 flag = 1;
52 f();