From a7a3627ab2f9f06e7725c6b6c796984684d0fdb8 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Fri, 5 May 2017 22:01:02 +0200 Subject: Fix segfault with invalid function def This invalid function definition: int f()[] {} was tried to be handled but there was no testcase if it actually worked. This fixes it and adds a TCC only testcase. --- tccgen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tccgen.c') diff --git a/tccgen.c b/tccgen.c index d7a5488..cbfe5ff 100644 --- a/tccgen.c +++ b/tccgen.c @@ -4013,7 +4013,7 @@ static int post_type(CType *type, AttributeDef *ad, int storage, int td) if (tok == '[') { next(); skip(']'); /* only handle simple "[]" */ - type->t |= VT_PTR; + mk_pointer(type); } /* we push a anonymous symbol which will contain the function prototype */ ad->a.func_args = arg_size; -- cgit v1.3.1