[llvm-bugs] [Bug 52051] New: Failure to optimize out __strcpy_chk when source can change but is always below buffer size
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Oct 3 08:12:55 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52051
Bug ID: 52051
Summary: Failure to optimize out __strcpy_chk when source can
change but is always below buffer size
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 buf[20];
void foo(bool c)
{
__builtin___strcpy_chk(buf, c ? "gh" : "e", sizeof(buf));
}
This can be optimized to `strcpy(buf, c ? "gh" : "e");`. This optimization 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/20211003/9b6754ce/attachment.html>
More information about the llvm-bugs
mailing list