Reputation: 12184
I'm testing a main function that simply returns void and am get core dump errors (signal 65 or 73) when running the bitcode with lli
:
define void @main() {
entry:
ret void
}
Is it a limitation of lli
or just plain illegal in LLVM?
I'm well aware that in C++ the declaration of a main function with a return type of void is incorrect. In fact I've tried this with Clang (it's just a warning to do so) and get almost the same code (not exactly the same because of the #0
attributes, but close enough that I believe the differences are not causing this problem):
; Function Attrs: nounwind
define void @main() #0 {
entry:
ret void
}
Upvotes: 6
Views: 3393
Reputation: 26898
It doesn't crash for me, so the culprit must be something else:
$ echo "define void @main() {entry: ret void}" | lli -
$
In any case, lli supports void main methods, as you can see in ExecutionEngine::runFunctionAsMain()
.
Upvotes: 5