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 | 6cd82fb430f3fd83aee15a9dad4dc16b85440990 (patch) | |
tree | dd3bf369848196e1b02fa0876d42bb16a8e34249 /llvm/lib | |
parent | 8e23171fbca4160ecfa1b3454218a0004e0bfbfe (diff) | |
download | bcm5719-llvm-6cd82fb430f3fd83aee15a9dad4dc16b85440990.tar.gz bcm5719-llvm-6cd82fb430f3fd83aee15a9dad4dc16b85440990.zip |
"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!
llvm-svn: 68905
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp index 7e23c95cded..d53bc3f0ccc 100644 --- a/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp +++ b/llvm/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; } }; |