struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug3389647.c.in
blob51da48100bb6a6e303e5ad211c42b7c9371f8f43
1 /*
2 bug3389647.c
3 memory: __code, _STATMEM
4 */
6 #include <testfwk.h>
8 #if defined (__SDCC)
9 #pragma disable_warning 196 //no warning about pointer const qualifier (W_TARGET_LOST_QUALIFIER)
10 #include <sdcc-lib.h> /* just to get _STATMEM */
11 #endif
13 typedef unsigned char hid_report_descriptor[8];
15 {memory} char dummy = 0; /*prevent hid_report_descriptor to land at address 0 */
16 {memory} hid_report_descriptor HIDREPORTDESC =
18 0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Defined Page 1)
19 0x09, 0x01, // USAGE (Vendor Usage 1)
20 0xa1, 0x01, // COLLECTION (Application)
23 unsigned char* DATAPTR1 = ({memory} unsigned char*)&HIDREPORTDESC;
24 unsigned char* DATAPTR2 = ( unsigned char*)&HIDREPORTDESC;
26 void testBug(void)
28 unsigned char* DATAPTR3 = ({memory} unsigned char*)&HIDREPORTDESC;
29 unsigned char* DATAPTR4 = ( unsigned char*)&HIDREPORTDESC;
31 ASSERT(DATAPTR1 == DATAPTR2);
32 /* FIXME: maybe a bug in gpsim */
33 #define MEMORY_{memory} 1
34 #if !(defined(__SDCC_pic14) && defined(__SDCC_PIC14_ENHANCED) && defined(MEMORY___code))
35 ASSERT(DATAPTR2 == DATAPTR3);
36 #endif
37 ASSERT(DATAPTR3 == DATAPTR4);