[Bug c/47980] New: Inefficient code for local const char arrays
rafael.espindola at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Mar 3 21:40:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47980
Summary: Inefficient code for local const char arrays
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: rafael.espindola@gmail.com
gcc will compile
--------------------
void f(const char *p);
void g(void) {
const char foo[] = "aoeuaoeuaeouaeouaoeuaoeaoxbxod";
f(foo);
}
----------------------
to
.cfi_startproc
subq $40, %rsp
.cfi_def_cfa_offset 48
movl $.LC0, %esi
movl $31, %ecx
leaq 1(%rsp), %rdi
rep movsb
leaq 1(%rsp), %rdi
call f
addq $40, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
No idea why it wants to copy the string before calling f.
More information about the Gcc-bugs
mailing list