1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

Fix off by 1 bug in printf->puts lowering.

llvm-svn: 43309
This commit is contained in:
Dale Johannesen 2007-10-24 20:14:50 +00:00
parent b3085f2d74
commit 414ad5d4a4

View File

@ -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));
}