This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/81356] New: __builtin_strcpy is not good for copying an empty string on aarch64
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 08 Jul 2017 05:13:59 +0000
- Subject: [Bug target/81356] New: __builtin_strcpy is not good for copying an empty string on aarch64
- Auto-submitted: auto-generated
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