stackloop: `main` should return `int`, not `void`
samuelgruetter opened this issue · comments
bedrock2 currently fails to build on my system because bedrock2/special/stackloop
returns a random garbage non-zero exit code:
[sam@samsdell special]$ ./stackloop
[sam@samsdell special]$ echo $?
159
[sam@samsdell special]$ ./stackloop
[sam@samsdell special]$ echo $?
239
[sam@samsdell special]$ ./stackloop
[sam@samsdell special]$ echo $?
143
[sam@samsdell special]$ ./stackloop
[sam@samsdell special]$ echo $?
159
According to a quick google search, a C main
function's return type must be int
, and void
is not allowed (however, omitting the return
statement in main
is allowed, and it will default to 0 in that case).
My first idea to fix it was to change the bedrock2 source to have one return value, but then the pretty-printer would print uintptr_t
as the return type instead of int
. Another way would be to manually write a main
function in the .v
file like in ToCStringExprTypecheckingTest.v
. For the moment, I just replaced special/stackloop
by special/stackloop ; true
locally in my Makefile, but can you please apply a proper fix @andres-erbsen ?
the pretty-printer would print
uintptr_t
as the return type instead ofint
Is this actually an issue? If gcc accepts a void main function, it wouldn't surprise me if it also accepted other sorts of return types and just did a cast.