summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2018-05-16 21:45:39 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2018-05-16 21:45:39 +0000
commit8ac15bf4dcec8f5569b308f0d0ac70a5f154af85 (patch)
treeee2ce7e50f400051fad9585c91a75dca4796b5aa /llvm/lib/Transforms/Utils/BuildLibCalls.cpp
parent659932b0b2c7ec9895b34891f614970a22319c19 (diff)
downloadbcm5719-llvm-8ac15bf4dcec8f5569b308f0d0ac70a5f154af85.tar.gz
bcm5719-llvm-8ac15bf4dcec8f5569b308f0d0ac70a5f154af85.zip
[InstCombine] Fix the signature of fgets_unlocked.
It returns a pointer, not an int. This miscompiles all code that uses the return value of fgets. llvm-svn: 332531
Diffstat (limited to 'llvm/lib/Transforms/Utils/BuildLibCalls.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/BuildLibCalls.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
index bf912b078f6..5f5c4150d3b 100644
--- a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
@@ -1166,8 +1166,8 @@ Value *llvm::emitFGetSUnlocked(Value *Str, Value *Size, Value *File,
Module *M = B.GetInsertBlock()->getModule();
Constant *F =
- M->getOrInsertFunction("fgets_unlocked", B.getInt32Ty(), B.getInt8PtrTy(),
- B.getInt32Ty(), File->getType());
+ M->getOrInsertFunction("fgets_unlocked", B.getInt8PtrTy(),
+ B.getInt8PtrTy(), B.getInt32Ty(), File->getType());
inferLibFuncAttributes(*M->getFunction("fgets_unlocked"), *TLI);
CallInst *CI =
B.CreateCall(F, {castToCStr(Str, B), Size, File}, "fgets_unlocked");
OpenPOWER on IntegriCloud