summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp3
-rw-r--r--llvm/test/ExecutionEngine/Interpreter/call-no-args.ll10
2 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
index 64dca930722..044d9b7f27a 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
@@ -227,7 +227,8 @@ static bool ffiInvoke(RawFunc Fn, Function *F, ArrayRef<GenericValue> ArgVals,
Type *RetTy = FTy->getReturnType();
ffi_type *rtype = ffiTypeFor(RetTy);
- if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, NumArgs, rtype, &args[0]) == FFI_OK) {
+ if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, NumArgs, rtype, args.data()) ==
+ FFI_OK) {
SmallVector<uint8_t, 128> ret;
if (RetTy->getTypeID() != Type::VoidTyID)
ret.resize(TD.getTypeStoreSize(RetTy));
diff --git a/llvm/test/ExecutionEngine/Interpreter/call-no-args.ll b/llvm/test/ExecutionEngine/Interpreter/call-no-args.ll
new file mode 100644
index 00000000000..bd1f906fb04
--- /dev/null
+++ b/llvm/test/ExecutionEngine/Interpreter/call-no-args.ll
@@ -0,0 +1,10 @@
+; RUN: %lli -force-interpreter %s
+
+declare void @exit(i32)
+declare i32 @rand()
+
+define i32 @main() {
+ %ret = call i32 @rand()
+ call void @exit(i32 0)
+ ret i32 %ret
+}
OpenPOWER on IntegriCloud