aboutsummaryrefslogtreecommitdiff
path: root/examples/BrainF/BrainFDriver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/BrainF/BrainFDriver.cpp')
-rw-r--r--examples/BrainF/BrainFDriver.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/BrainF/BrainFDriver.cpp b/examples/BrainF/BrainFDriver.cpp
index 57a86fbf521..d704506d244 100644
--- a/examples/BrainF/BrainFDriver.cpp
+++ b/examples/BrainF/BrainFDriver.cpp
@@ -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);
}