public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/47980] New: Inefficient code for local const char arrays
@ 2011-03-03 21:40 rafael.espindola at gmail dot com
  2011-03-03 21:47 ` [Bug c/47980] " ktietz at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: rafael.espindola at gmail dot com @ 2011-03-03 21:40 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-03-04 16:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-03 21:40 [Bug c/47980] New: Inefficient code for local const char arrays rafael.espindola at gmail dot com
2011-03-03 21:47 ` [Bug c/47980] " ktietz at gcc dot gnu.org
2011-03-03 21:50 ` rafael.espindola at gmail dot com
2011-03-03 21:52 ` ktietz at gcc dot gnu.org
2011-03-03 22:00 ` jakub at gcc dot gnu.org
2011-03-04 16:26   ` Jan Hubicka
2011-03-03 22:00 ` [Bug middle-end/47980] " pinskia at gcc dot gnu.org
2011-03-03 23:07 ` pinskia at gcc dot gnu.org
2011-03-04 16:26 ` hubicka at ucw dot cz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).