#870 Use of bit variable generates bad assembler

closed-rejected
5
2013-05-25
2005-01-22
Anonymous
No

The attached program declares and uses a bit variable
x, giving the following output:

$ sdcc bug3.c
bug3.asm:197:Warning [202] Argument out of range. Least
significant bits used.
bug3.asm:202:Warning [202] Argument out of range. Least
significant bits used.
message: using default linker script
"/usr/local/share/gputils/lkr/18f452.lkr"

$ sdcc -v
SDCC : pic16 2.4.7 #933 (Jan 19 2005) (UNIX)

The relevant parts of the .asm file show that space is
allocated for two bytes, _x and bitfield0:

udata_bug3_0 udata
bitfield0 res 1

udata_bug3_1 udata
_x res 1

Then when it comes to be used, it generates
instructions using bit -1:

BANKSEL _x
; .line 10; bug3.c if (x) {
BTFSS _x,-1
GOTO _00107_DS_
; ;**{ 12625 genAssign
BANKSEL _x
; .line 11; bug3.c x = 0;
BCF _x,-1

Chris Emerson
sdcc@mail.nosreme.org

Discussion

  •  
    Attachments
  • Vangelis Rokas
    Vangelis Rokas
    2005-01-22

    Logged In: YES
    user_id=770505

    'bit' variables are not handled by pic16 port.
    They are currently accepted but this will not be
    the case starting from the next commit I'll do.
    Only bitfields in structures are supported.

     
  • Vangelis Rokas
    Vangelis Rokas
    2005-01-22

    • milestone: --> non_bugs
    • assigned_to: nobody --> vrokas
    • status: open --> closed-rejected