diff options
| author | 2025-11-15 20:12:53 +0100 | |
|---|---|---|
| committer | 2025-11-15 20:12:53 +0100 | |
| commit | 9abe27f6712852bd6a98d04baeca6d81470cc61c (patch) | |
| tree | 93783d8e39fb0098255862063833b911904813d7 /c | |
| parent | 09aad0efecdc4dea8a09b16976ec9639a6f97655 (diff) | |
c: due to __builtin_trap (in the future also things like noreturn function calls), compileexpr() can terminate current block. add checks for that in callexpr. more are probably needed..
Diffstat (limited to 'c')
| -rw-r--r-- | c/c.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -3097,12 +3097,16 @@ compilecall(struct function *fn, const struct expr *ex) assert(ins.cls || ex->ty.t == TYVOID); } ins.l = exprvalue(fn, &sub[0]); - for (int i = 0; i < ex->narg; ++i) { + for (int i = 0; i < ex->narg && fn->curblk; ++i) { struct expr *arg = &sub[i+1]; union type ty = i < td->nmemb ? td->param[i] : argpromote(arg->ty); union ref r = cvt(fn, ty, typedecay(arg->ty), exprvalue(fn, arg)); vpush(&insns, mkarginstr(mkirtype(ty), r)); } + if (!fn->curblk) { + vfree(&insns); + return NOREF; + } for (int i = 0; i < insns.n; ++i) addinstr(fn, insns.p[i]); vfree(&insns); |