------- Comment #7 from urjaman at gmail dot com 2008-08-07 07:51 ------- I did a simple test on my avr-gcc 4.2.2 and it seems that this bug (i dont think it should be Resolution: INVALID but...) is fixed in 4.2.2 atleast. I changed the register used in the example to r2 to see if the AVR's incapability to do andi (AND immediate) on r0-r15 would cause any problems, but even this didnt cause the bug. Here's the objdump output:
while(1) { if ( flags & 0x02 ) // Some event detected 8: 21 fe sbrs r2, 1 a: fe cf rjmp .-4 ; 0x8 <main+0x8> { flags &= (0xFF-0x02); // Clear flag c: 8d ef ldi r24, 0xFD ; 253 e: 28 22 and r2, r24 10: 21 fe sbrs r2, 1 12: fa cf rjmp .-12 ; 0x8 <main+0x8> 14: fb cf rjmp .-10 ; 0xc <main+0xc> -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17336