diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-12 18:22:33 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-12 18:22:33 +0000 |
commit | 5db4cdfc56f17959d3d0d3067af1b2346bcc0120 (patch) | |
tree | 0816df6e67751961072ba3addaec342d1b702447 | |
parent | 1cefb7419088baabbb1ada78f520b92e980a0a6c (diff) |
"There was a typo in my previous patch which leads to miscompilation of
strncat :(
strncat(foo, "bar", 99)
would be optimized to
memcpy(foo+strlen(foo), "bar", 100, 1)
instead of
memcpy(foo+strlen(foo), "bar", 4, 1)"
Patch by Benjamin Kramer!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68905 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/SimplifyLibCalls.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/lib/Transforms/Scalar/SimplifyLibCalls.cpp index 7e23c95cde..d53bc3f0cc 100644 --- a/lib/Transforms/Scalar/SimplifyLibCalls.cpp +++ b/lib/Transforms/Scalar/SimplifyLibCalls.cpp @@ -582,7 +582,7 @@ struct VISIBILITY_HIDDEN StrNCatOpt : public StrCatOpt { // strncat(x, s, c) -> strcat(x, s) // s is constant so the strcat can be optimized further - EmitStrLenMemCpy(Src, Dst, Len, B); + EmitStrLenMemCpy(Src, Dst, SrcLen, B); return Dst; } }; |