From c092f2ed6102131fc02523db8b87482e7a5b9f10 Mon Sep 17 00:00:00 2001 From: Udo Date: Fri, 7 Feb 2020 23:23:31 +0100 Subject: [PATCH] Check if symbol given for attr. cleanup is actually a function --- tccgen.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tccgen.c b/tccgen.c index 6fd24760..06baf360 100644 --- a/tccgen.c +++ b/tccgen.c @@ -3664,7 +3664,13 @@ redo: tcc_warning("implicit declaration of function '%s'", get_tok_str(tok, &tokc)); s = external_global_sym(tok, &func_old_type); - } + } + else if ( (s->type.t & VT_BTYPE) == VT_FUNC ) { + ad->cleanup_func = s; + } + else { + tcc_error("'%s' is not declared as function", get_tok_str(tok, &tokc)); + } ad->cleanup_func = s; next(); skip(')');