summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-2216.c
blob: 2f112be95d22b3f30203c9e5c0b09655532fe5d4 (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
42
43
/*      bug-2216.c
*/

#include <testfwk.h>

#define BIG_ARRAY ((__xdata volatile unsigned char *)0x8000) // XDATA Memory

typedef __data union
{
        struct
        {
                unsigned char bit0 : 1;
                unsigned char bit1 : 1;
                unsigned char bit2 : 1;
                unsigned char bit3 : 1;
                unsigned char bit4 : 1;
                unsigned char bit5 : 1;
                unsigned char bit6 : 1;
                unsigned char bit7 : 1;
        } bits;
        unsigned char byte;
} byte_in_bit_memory;

byte_in_bit_memory __at (0x20) first_byte;

__data unsigned char __at (0x21) dummy_byte;

/* This failed with: Internal error: validateOpType failed in
   OP_SYMBOL(IC_RESULT (ic)) @ SDCCptropt.c:335: expected symbol, got value */
void foo(void)
{
        BIG_ARRAY[0] = first_byte.byte;
}

void bar(void)
{
        BIG_ARRAY[0] = dummy_byte;
}

void testBug(void)
{
        ASSERT(1);
}