The C166 compiler generates incorrect code when using __inline functions with bit return type. Test source code:
bit bitvar1 = 1; bit bitvar2; __inline bit test() { return bitvar1; } void main() { bitvar2 = test(); }
9: void main() 10: { 0000000A 4A00F000 BMOV R0.0,0xFD00.0 11: bitvar2 = test(); 0000000E 4AF00001 BMOV 0xFD00.1,R0.0 12: } 00000012 CB00 RET
; line 4: __inline bit test() ; line 5: { ; line 6: return bitvar1; BMOV R4.0,bitvar1 ; line 7: } RET ; line 8: ; line 9: void main() ; line 10: { ; line 11: bitvar2 = test(); CALL test BMOV bitvar2,R4.0 ; line 12: } RET
Hi, Stefan, thanks for find this bug No problem. But does it mean that I don't have to report this bug to Keil anymore? I mean, with your interest in the bug, it sounds like you work for Keil. If not, how do I report a bug? Do I write an email to support.intl@keil.com? There is a couple more bugs I found some time ago. One of them was in the implementation of scanf and the other was in RTX166 tiny. So while I am at it, I could as well verify that the bugs are still there and report them too. - mike