From: Scott Dattalo <scott@da...>  20001116 04:35:58

In the pic port, I noticed SDCC implicitly casts bit types when bits are in expressions involving other types that are larger than chars. For example, Declare this: int aint0 = 0; char achar0 =0; bit bit0 = 0; And then try this: achar0 += bit0; //t.c 45 aint0 += bit0; //t.c 46 For the char, there is no implicit cast but for the int there is. Here's the raw dump: t.c(45:0:53:0:0) iTemp35 [k47 lr0:0 so:0]{ ia0 re0 rm0}{char } = _achar0 [k5 lr0:0 so:0]{ ia0 re0 rm0}{char } + _bit0 [k3 lr0:0 so:0]{ ia0 re0 rm0}{bit {0,1}} t.c(45:0:54:0:0) iTemp36 [k48 lr0:0 so:0]{ ia0 re0 rm0}{char } := iTemp35 [k47 lr0:0 so:0]{ ia0 re0 rm0}{char } t.c(45:0:55:0:0) _achar0 [k5 lr0:0 so:0]{ ia1 re0 rm0}{char } := iTemp36 [k48 lr0:0 so:0]{ ia0 re0 rm0}{char } t.c(46:0:56:0:0) iTemp37 [k49 lr0:0 so:0]{ ia0 re0 rm0}{int } = (int )_bit0 [k3 lr0:0 so:0]{ ia0 re0 rm0}{bit {0,1}} t.c(46:0:57:0:0) iTemp38 [k50 lr0:0 so:0]{ ia0 re0 rm0}{int } = _aint0 [k25 lr0:0 so:0]{ ia0 re0 rm0}{int } + iTemp37 [k49 lr0:0 so:0]{ ia0 re0 rm0}{int } t.c(46:0:58:0:0) iTemp39 [k51 lr0:0 so:0]{ ia0 re0 rm0}{int } := iTemp38 [k50 lr0:0 so:0]{ ia0 re0 rm0}{int } t.c(46:0:59:0:0) _aint0 [k25 lr0:0 so:0]{ ia1 re0 rm0}{int } := iTemp39 [k51 lr0:0 so:0]{ ia0 re0 rm0}{int } The first raw line for t.c,46 has the iCode Cast. Why? At what point does the compiler introduce this? The reason I want to know is because the cast is unnecessary for the Pic port and causes a whole bunch of code to be generated. Thanks, Scott 