Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#2252 An error in generating plus of STM8

closed-fixed
None
STM8
7
2014-02-12
2014-02-12
Ben Shi
No

the following c code
int abc(int a)
{
return a + 0xff;
}

is generated to
; -----------------------------------------
; function abc
; -----------------------------------------
_abc:
; a.c: 3: return a + 0xff;
ldw x, (0x03, sp)
decw x
ret

That should be wrong, since int is 16-bit, 0xff is not -1, but 0xffff is.

1 Attachments
a.c

Discussion

  • Increasing priority, since bad code is generated silently.

    Philipp

     
    • assigned_to: Philipp Klaus Krause
    • Priority: 5 --> 7
     
  • Fixed in revision #8943.

    Philipp

     
    • status: open --> closed-fixed