[llvm-commits] [llvm] r43309 - /llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp
Dale Johannesen
dalej at apple.com
Wed Oct 24 13:14:51 PDT 2007
Author: johannes
Date: Wed Oct 24 15:14:50 2007
New Revision: 43309
URL: http://llvm.org/viewvc/llvm-project?rev=43309&view=rev
Log:
Fix off by 1 bug in printf->puts lowering.
Modified:
llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp
Modified: llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp?rev=43309&r1=43308&r2=43309&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp Wed Oct 24 15:14:50 2007
@@ -1211,8 +1211,10 @@
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));
}
More information about the llvm-commits
mailing list