AnsweredAssumed Answered

Cosmic Compiler Bug

Question asked by theengguy on Mar 4, 2013
Latest reply on Mar 5, 2013 by luca
I'm using Cosmic Eval C Compiler V 4.3.7.

The code of concern is as follows:
if( RST->SR & (u8)0x02 == (u8)0x02)
{....}

I'm simply checking bit 1 of the reset register. I checked the disassembler because the program was not working as expected and this is what I found:

main.c:215  if( RST->SR & (u8)0x02 == (u8)0x02){
0x9272 <.ckResetForIWDG+12> 0xC650B3        LD    A,0x50b3            LD    A,0x50b3
0x9275 <.ckResetForIWDG+15> 0xA501          BCP   A,#0x01             BCP   A,#0x01
0x9277 <.ckResetForIWDG+17> 0x275F          JREQ  0x92d8 
.....}

This is clearly why my program will not work as expected, the disassembler tells me that I'm checking bit 0 not bit 1! Am I missing something?

Outcomes