It's not often one runs into compiler bugs when working with mature compilers on common platforms.

But when you're working on an embedded platform with a compiler less popular and used than gcc or visual, the danger of running into bugs is much greater.

This morning, for instance, we spent two hours hunting a bug that turned out to be in the assembly optimizer of our compiler - HiTECH C for PIC18.

After unrolling a function call and gasping at the sight of it returning different results from a direct call, I finally tried to fiddle with the disassembly and turn off the optimizations. Then, it just worked.

A detailed bug report was sent to the compiler's support team, of course. Hope they can fix it - for now we won't use optimizations.