Hello all,

When I develop a 8051 program with sdcc-20100320-5743, I get a problem about
the warning 180, the whole message is:

warning 180: using ~ on bit/bool/unsigned char variables can give unexpected
results due to promotion to int

The corresponding codes are:
======================================
   54 void motor_switch_ori()
-  55 {
|  56         mori = ~mori;
|  57 }
======================================
the asm code generated by sdcc is:
======================================
  467 _motor_switch_ori:
  468 ;       motor_control.c:56: mori = ~mori;
  469         setb    _P1_6
  470         ret
======================================
which is definitely not what I want. What could I do to reverse a bit? Or
it's a compiler's bug?

-- 
Cheers,
Grissiom
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to