diff --git a/tccgen.c b/tccgen.c index ed26711..d5deb03 100644 --- a/tccgen.c +++ b/tccgen.c @@ -5639,6 +5639,11 @@ static void gfunc_param_typed(Sym *func, Sym *arg) int func_type; CType type; + if ((vtop->type.t & VT_BTYPE) == VT_VOID) + tcc_error("argument type is void"); + if ((vtop->type.t & VT_BTYPE) == VT_STRUCT && vtop->type.ref->c < 0) + tcc_error("argument has incomplete type"); + func_type = func->f.func_type; if (func_type == FUNC_OLD || (func_type == FUNC_ELLIPSIS && arg == NULL)) { @@ -6494,6 +6499,8 @@ special_math_val: ret.r2 = VT_CONST; /* compute first implicit argument if a structure is returned */ if ((s->type.t & VT_BTYPE) == VT_STRUCT) { + if (s->type.ref->c < 0) + tcc_error("function has incomplete return type"); variadic = (s->f.func_type == FUNC_ELLIPSIS); ret_nregs = gfunc_sret(&s->type, variadic, &ret.type, &ret_align, ®size);