diff --git a/tools/qfcc/source/expr_process.c b/tools/qfcc/source/expr_process.c index c76b44fc3..45d6297ed 100644 --- a/tools/qfcc/source/expr_process.c +++ b/tools/qfcc/source/expr_process.c @@ -761,11 +761,14 @@ proc_decl (const expr_t *expr, rua_ctx_t *ctx) if (decl_spec.type && decl_spec.type_expr) { internal_error (0, "both type and type_expr set"); } + int count = list_count (&expr->decl.list); + if (!count) { + return block; + } if (decl_spec.storage == sc_local) { scoped_src_loc (expr); block = new_block_expr (nullptr); } - int count = list_count (&expr->decl.list); const expr_t *decls[count]; list_scatter (&expr->decl.list, decls); for (int i = 0; i < count; i++) { diff --git a/tools/qfcc/source/function.c b/tools/qfcc/source/function.c index f989a2320..666427efb 100644 --- a/tools/qfcc/source/function.c +++ b/tools/qfcc/source/function.c @@ -1032,7 +1032,7 @@ find_function (const expr_t *fexpr, const expr_t *params, rua_ctx_t *ctx) list_scatter_rev (¶ms->list, args); } - callparm_t call_params[num_params] = {}; + callparm_t call_params[num_params + 1] = {}; for (int i = 0; i < num_params; i++) { auto e = args[i]; if (e->type == ex_error) { @@ -1083,7 +1083,7 @@ find_function (const expr_t *fexpr, const expr_t *params, rua_ctx_t *ctx) } } - unsigned costs[num_funcs] = {}; + unsigned costs[num_funcs + 1] = {}; for (int i = 0; i < num_funcs; i++) { auto f = (metafunc_t *) funcs[i]; int num_params = f->type->func.num_params;