------- Comment #9 from abnikant dot singh at atmel dot com 2010-09-07 11:36 ------- gcc version 4.6.0 20100907 (experimental) is not performing the inline in -Os for the test case:
#define UCSRA (*(volatile unsigned char *)0x2B) #define UDRE 5 #define UDR (*(volatile unsigned char *)0x2C) static void putch(char ch); void putch(char ch) { while (!(UCSRA & (1<<UDRE))); UDR = ch; } int main(void) { putch(0); putch(1); return 0; } The generated assembly with avr-gcc -S -Os test.c is: putch: /* prologue: function */ /* frame size = 0 */ /* stack size = 0 */ .L__stack_usage = 0 .L2: sbis 43-0x20,5 rjmp .L2 out 44-0x20,r24 /* epilogue start */ ret .size putch, .-putch .global main .type main, @function main: /* prologue: function */ /* frame size = 0 */ /* stack size = 0 */ .L__stack_usage = 0 ldi r24,lo8(0) rcall putch ldi r24,lo8(1) rcall putch ldi r24,lo8(0) ldi r25,hi8(0) /* epilogue start */ ret -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31528