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.
There seems to be a bug related to the optimization of comparisons into and introduced by Borut in revision #6726. To reproduce, use the attached regression test. I noticed the bug in sdcc revision #8626.
Fixed in svn #8676 by by disabling optimization of comparison unsigned with 2^n literal since it is broken: it was already broken when introduced for the first time with patch #129 Summary of all uncommitted changes I applied on "my" SDCC.
It looks to me like the optimization is not the bug, but it triggers a live range problem. When I compile the test case with --no-peep for mcs51 I see r7 being overwritten with the value for c to be propagated to the false case. But r7 still holds the msb of i here and still needs to be tested. Using any other register for the propagation would be ok.