600205523119f671e7b3090a3af20a7d54dc0e9a
[fw/sdcc] / support / regression / tests / bug-460010.c
1 /* bug 460010
2  */
3 #include <testfwk.h>
4
5 #if defined __mcs51 || defined __ds390 || defined __xa51
6 #define XDATA xdata
7 #else
8 #define XDATA
9 #endif
10
11 void 
12 func( unsigned char a )
13 {
14   UNUSED(a);
15 }
16
17 void
18 testBadPromotion(void)
19 {
20
21 #ifdef SDCC
22   unsigned char c=*((unsigned XDATA char*)(0xa000));
23 #else
24   unsigned char loc_c;
25   unsigned char c=*(unsigned char*)&loc_c;
26 #endif 
27   
28   func(c); 
29   
30   c+='0'; /* is evaluated as an 8-bit expr */ 
31   
32   func(c); 
33
34   c+='A'-'0'; /* is a 16-bit expr ??? */ 
35   
36   func(c); 
37 }