#999 Sign extension of bit fields

closed-fixed
5
2013-05-25
2005-10-25
riedel
No

Bug 1019480 seems to apply to pic target as well

debug_val simply gives me the (unsigned) content of the
var:

typedef enum{
FS_Flash_Buffer_Invalid=-1,
FS_Flash_Buffer_1,
FS_Flash_Buffer_2,
FS_Flash_Buffer_num
} _FS_Flash_Buffer;

static struct buffer
{
signed buffer:3;
unsigned dirty:1;
signed table:4;
}_current={FS_Flash_Buffer_Invalid,0,0};

int8_t x=_current.buffer;

debug_val(_current.buffer,8);
-> 7 (maybe correct ?)
debug_val(x,8);
-> 7 (incorrect!)
debug_val(FS_Flash_Buffer_Invalid,8);
-> 255 (just to check)
debug_val(_current.buffer==FS_Flash_Buffer_Invalid,8);
->0 (probably incorrect)
debug_val(x==FS_Flash_Buffer_Invalid,8);
->0 (incorrect!)
debug_val(_current.buffer>0,8);
->1 (incorrect!!)

Discussion

  • Raphael Neider
    Raphael Neider
    2005-10-26

    Logged In: YES
    user_id=1115835

    Fixed in SDCC 2.5.3 #1126 for PIC16 (and will be fixed for
    pic14 in my next commit).

     
  • Raphael Neider
    Raphael Neider
    2005-10-26

    • milestone: 100454 --> fixed
    • assigned_to: nobody --> tecodev
    • status: open --> closed-fixed