diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
commit | 71d5a2540a98c81f5bcaeb48805e0e2881f530ef (patch) | |
tree | 5343938942df402b49ec7300a1c25a2d4ccd5821 /examples/BrainF/BrainFDriver.cpp | |
parent | 31bbf64f3a4974a2d6c8b3b27ad2f519caf74057 (diff) |
Diffstat (limited to 'examples/BrainF/BrainFDriver.cpp')
-rw-r--r-- | examples/BrainF/BrainFDriver.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/BrainF/BrainFDriver.cpp b/examples/BrainF/BrainFDriver.cpp index 57a86fbf5212..65f8033a7e27 100644 --- a/examples/BrainF/BrainFDriver.cpp +++ b/examples/BrainF/BrainFDriver.cpp @@ -77,7 +77,7 @@ void addMainFunction(Module *mod) { getOrInsertFunction("main", IntegerType::getInt32Ty(mod->getContext()), IntegerType::getInt32Ty(mod->getContext()), PointerType::getUnqual(PointerType::getUnqual( - IntegerType::getInt8Ty(mod->getContext()))), NULL)); + IntegerType::getInt8Ty(mod->getContext()))))); { Function::arg_iterator args = main_func->arg_begin(); Value *arg_0 = &*args++; @@ -166,6 +166,10 @@ int main(int argc, char **argv) { std::vector<GenericValue> args; Function *brainf_func = M.getFunction("brainf"); GenericValue gv = ee->runFunction(brainf_func, args); + // Genereated code calls putchar, and output is not guaranteed without fflush. + // The better place for fflush(stdout) call would be the generated code, but it + // is unmanageable because stdout linkage name depends on stdlib implementation. + fflush(stdout); } else { WriteBitcodeToFile(Mod.get(), *out); } |