harec

[hare] Hare compiler, written in C11 for POSIX OSs
Log | Files | Refs | README | LICENSE

commit 6cee56a9ed63ce3cb53cb1e547f9c66f9db507f9
parent 1a0c7945dee0e9ee9e99a7b273268c64a7861a92
Author: Bor Grošelj Simić <bgs@turminal.net>
Date:   Fri, 18 Nov 2022 09:18:43 +0100

reintroduce a call to handle_errors after checking a function

The call was erroneusly removed in c7d58402 which made it possible to
trigger a segmentation fault when fntype was set to void (because of a
compile error) instead of a function type.

Fixes: https://todo.sr.ht/~sircmpwn/hare/765
Signed-off-by: Bor Grošelj Simić <bgs@turminal.net>

Diffstat:
Msrc/check.c | 1+
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/src/check.c b/src/check.c @@ -3236,6 +3236,7 @@ check_function(struct context *ctx, struct expression *body = xcalloc(1, sizeof(struct expression)); check_expression(ctx, afndecl->body, body, fntype->func.result); // TODO: Pass errors up and deal with them at the end of check + handle_errors(ctx->errors); char *restypename = gen_typename(body->result); char *fntypename = gen_typename(fntype->func.result);