A simple bitwise operation such as: WDT_EN &= ~1 compiles to suboptimal code, such as:
mov r7,_WDT_EN
mov a,#0xFE
anl a,r7
mov _WDT_EN,a
This is especially troublesome when the operation is expected to be atomic (such as clearing interrupt flags). I've hit this issue when porting code which originally targeted Keil C51.
Casting the RHS to an 8-bit type solves the problem, as seen below:
; main.c:29: WDT_EN&=(unsigned char)~1;
anl _WDT_EN,#0xFE
; main.c:30: WDT_EN&=0xfe;
anl _WDT_EN,#0xFE
Tested on SDCC 4.1.0 #12072
Sorry, it seems that I've mixed something up. I've re-tested it and I see that SDCC 4.1.0 produces the expected optimal code. The bug can be closed.