http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46647
Summary: Can't inline memset with -1 Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: hjl.to...@gmail.com CC: ubiz...@gmail.com [...@gnu-16 gcc]$ cat /tmp/x.i char a[4]; int func1 (void) { __builtin_memset (a,-1,sizeof (a)); return 0; } int func2 (void) { __builtin_memset (a,123,sizeof (a)); return 0; } [...@gnu-16 gcc]$ ./xgcc -B./ -S /tmp/x.i -O2 -m32 [...@gnu-16 gcc]$ cat x.s .file "x.i" .text .p2align 4,,15 .globl func1 .type func1, @function func1: .LFB0: .cfi_startproc subl $28, %esp .cfi_def_cfa_offset 32 movl $4, 8(%esp) movl $-1, 4(%esp) movl $a, (%esp) call memset xorl %eax, %eax addl $28, %esp .cfi_def_cfa_offset 4 ret .cfi_endproc .LFE0: .size func1, .-func1 .p2align 4,,15 .globl func2 .type func2, @function func2: .LFB1: .cfi_startproc movl $2071690107, a xorl %eax, %eax ret .cfi_endproc .LFE1: .size func2, .-func2 .comm a,4,1 .ident "GCC: (GNU) 4.6.0 20101124 (experimental) [trunk revision 167121]" .section .note.GNU-stack,"",@progbits [...@gnu-16 gcc]$ Why can't we inline __builtin_memset (a,123,sizeof (a))?