Right now, cproc can segfault if it tries to call a function with a long double
argument. We currently detect a missing representation when we try to emit it, but we should actually just prevent construction of a value with no QBE representation in the first place.
Another manifestation of this bug is if you try to call a function returning long double
, ignoring the result. This should be a compile error, but cproc compiles it as if it were void
.
funcinst
currently uses repr == NULL
for function calls to indicate that it has no return value, so we can't tell if we are calling a function with no return value, or the return value has no representation.
To fix this, perhaps we could add a special funccall
function to create call instructions. There is already some call-specific code in funcinst
, so this is probably the right thing to do.