From 4e70521d74cb10b795825f7376539ed493dd2ac3 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Sat, 11 Apr 2020 11:19:31 +0200 Subject: bad-goto: do not linearize function with undeclared labels It's not possible to produce a valid & correct IR if the function contains a goto to an undeclared label. So, try to catch these situations and mark the function as such, the linearization will then simply ignore it. Signed-off-by: Luc Van Oostenryck --- evaluate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/evaluate.c b/evaluate.c index d4b46227..c757fc82 100644 --- a/evaluate.c +++ b/evaluate.c @@ -3750,6 +3750,7 @@ static void evaluate_goto_statement(struct statement *stmt) if (label->namespace == NS_LABEL && !label->stmt) { sparse_error(stmt->pos, "label '%s' was not declared", show_ident(label->ident)); + current_fn->bogus_linear = 1; } } -- cgit 1.2.3-korg