This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/81356] New: __builtin_strcpy is not good for copying an empty string on aarch64


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81356

            Bug ID: 81356
           Summary: __builtin_strcpy is not good for copying an empty
                    string on aarch64
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64-linux-gnu

Take:
void f(char *a)
{
  __builtin_strcpy (a, "");
}

---- CUT ---
This produces:
f:
        adrp    x1, .LC0
        ldrb    w1, [x1, #:lo12:.LC0]
        strb    w1, [x0]
        ret

But why can't it be just:
f:
        strb    wzr, [x0]
        ret

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]