#1239 wrong condition tested: != ~> &

closed-rejected
nobody
z80 port (188)
5
2006-11-14
2006-11-14
No

sdcc generates wrong code for the attached simple test case.
There are two tests for equality in the if, one "!= 42", one "!= 23", but sdcc generates "& 1" instead for both of them. This is a bug in the compiler itself, not the peephole optimizer, since --no-peep doesn'T help.

I use sdcc #4399

Philipp

Discussion

  • Philipp Klaus Krause

    conditions in if compiled to wrong asm.

     
    Attachments
  • Philipp Klaus Krause

    Logged In: YES
    user_id=564030
    Originator: YES

    Sorry, I stated the problem a bit incorrectly:
    There are tests of the form (a & 0xff) != 42 and (b & 0xff) != 23, sdcc generates code as if these were (a & 0x01) and (b & 0x01).

     
  • Philipp Klaus Krause

    • status: open --> closed-rejected
     
  • Philipp Klaus Krause

    Logged In: YES
    user_id=564030
    Originator: YES

    I got operator precedence wrong. Sorry for the noise.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks