[llvm-bugs] [Bug 46409] New: Failure to optimize out strcpy call when passed a parameter that could be evaluated at constant time
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Jun 21 02:10:16 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46409
Bug ID: 46409
Summary: Failure to optimize out strcpy call when passed a
parameter that could be evaluated at constant time
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: gabravier at gmail.com
CC: llvm-bugs at lists.llvm.org
char *f(void)
{
char *p = (char *)malloc(1);
char s[] = "";
strcpy(p, s);
return p;
}
The call to strcpy can be omitted her and just replaced by `*p = 0;`. This
transformation is done by GCC, but not by LLVM.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200621/791f7205/attachment.html>
More information about the llvm-bugs
mailing list