diff options
author | Dale Johannesen <dalej@apple.com> | 2007-10-24 20:14:50 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2007-10-24 20:14:50 +0000 |
commit | 0fcee0639e6de9f40dbf63b4d0d6f807a3d87ac5 (patch) | |
tree | d4dec7ee0330e28f01b882b2ea9d5031c49d09de /lib | |
parent | 6e9b49664357bf970ebabc94ce3295ec5f41413b (diff) | |
download | external_llvm-0fcee0639e6de9f40dbf63b4d0d6f807a3d87ac5.zip external_llvm-0fcee0639e6de9f40dbf63b4d0d6f807a3d87ac5.tar.gz external_llvm-0fcee0639e6de9f40dbf63b4d0d6f807a3d87ac5.tar.bz2 |
Fix off by 1 bug in printf->puts lowering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43309 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/IPO/SimplifyLibCalls.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/SimplifyLibCalls.cpp b/lib/Transforms/IPO/SimplifyLibCalls.cpp index 717a5a8..0904c4c 100644 --- a/lib/Transforms/IPO/SimplifyLibCalls.cpp +++ b/lib/Transforms/IPO/SimplifyLibCalls.cpp @@ -1211,8 +1211,10 @@ public: new CallInst(SLC.get_puts(), GV, "", CI); if (CI->use_empty()) return ReplaceCallWith(CI, 0); + // The return value from printf includes the \n we just removed, so +1. return ReplaceCallWith(CI, - ConstantInt::get(CI->getType(), FormatStr.size())); + ConstantInt::get(CI->getType(), + FormatStr.size()+1)); } |