struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2568.c
blobf1f5442baf626e9f1e9eb82b89b6ba845edcd6e5
1 /*
2 bug-2568.c
3 */
5 #include <testfwk.h>
7 #include <stdint.h>
9 #if defined(__SDCC_pic16)
10 #define ADDR 0x0200
11 #elif defined(__SDCC_pic14)
12 #define ADDR 0x0100
13 #elif defined(__SDCC_stm8)
14 #define ADDR 0x1000
15 #elif defined(__SDCC_f8)
16 #define ADDR 0x3800
17 #elif defined(__SDCC_pdk14) || defined(__SDCC_pdk15)
18 #define ADDR 0x70
19 #else
20 #define ADDR 0xca00
21 #endif
23 #if defined(__SDCC) && !defined(__SDCC_mcs51) && !defined(__SDCC_ds390)
24 uint16_t __at(ADDR) a[6] = {0, 1, 2, 3, 4, 5};
25 #endif
27 void testBug(void)
29 #if defined(__SDCC) && !defined(__SDCC_mcs51) && !defined(__SDCC_ds390)
30 volatile uint8_t v;
31 uint16_t eeprom1, eeprom2;
33 eeprom1 = ((uint16_t *)ADDR)[4];
34 v = 4; eeprom2 = ((uint16_t *)ADDR)[v];
36 ASSERT(eeprom1 == eeprom2);
37 #endif