about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2018-01-15 10:35:19 +0100
committerMartinNowack <martin.nowack@gmail.com>2018-10-26 13:31:07 +0100
commit6f5537fc9080c03bc1c9f7e8e0d6bb93c5b03e2d (patch)
tree53915051372e8c4a7725fedb75ae422fd6ecb168
parent54851ed24b9d8a8937d7bf7d02ee6020ef770204 (diff)
downloadklee-6f5537fc9080c03bc1c9f7e8e0d6bb93c5b03e2d.tar.gz
llvm5: avoid ++ on function->arg_begin()
Starting with llvm 5, arguments of a function are not an iterator, but
an array. So they cannot be incremented in-place. Add a local auto
variable and increment that.

Otherwise we see:
../tools/klee/main.cpp:661:23: error: expression is not assignable
  Value *oldArgv = &*(++mainFn->arg_begin());
                      ^ ~~~~~~~~~~~~~~~~~~~

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
-rw-r--r--tools/klee/main.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 4b32c00b..0cbeaa96 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -1032,7 +1032,8 @@ createLibCWrapper(std::vector<std::unique_ptr<llvm::Module>> &modules,
   args.push_back(
       llvm::ConstantExpr::getBitCast(inModuleRefernce, ft->getParamType(0)));
   args.push_back(&*(stub->arg_begin())); // argc
-  args.push_back(&*(++stub->arg_begin())); // argv
+  auto arg_it = stub->arg_begin();
+  args.push_back(&*(++arg_it)); // argv
   args.push_back(Constant::getNullValue(ft->getParamType(3))); // app_init
   args.push_back(Constant::getNullValue(ft->getParamType(4))); // app_fini
   args.push_back(Constant::getNullValue(ft->getParamType(5))); // rtld_fini