aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ll.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/ll.cpp b/ll.cpp
index f3082e1..0b81628 100644
--- a/ll.cpp
+++ b/ll.cpp
@@ -765,8 +765,14 @@ main()
}
void* fp = engine->getPointerToFunction(f);
- double (*cfunc)() = (double (*)())fp;
- std::cout << cfunc();
+ if (bodyT->ctype == Type::Int32Ty)
+ std::cout << ((int32_t (*)())fp)();
+ else if (bodyT->ctype == Type::FloatTy)
+ std::cout << ((float (*)())fp)();
+ else if (bodyT->ctype == Type::Int1Ty)
+ std::cout << ((bool (*)())fp)();
+ else
+ std::cout << "?";
} else {
Value* val = body->compile(cenv);