This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/31528] Inlining with -Os increases code size
- From: "abnikant dot singh at atmel dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Sep 2010 11:36:39 -0000
- Subject: [Bug middle-end/31528] Inlining with -Os increases code size
- References: <bug-31528-11199@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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