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.
This commit is contained in:
parent
d4878985e8
commit
a7a3627ab2
2 changed files with 6 additions and 1 deletions
2
tccgen.c
2
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;
|
||||
|
|
|
@ -176,6 +176,11 @@ static int onetwothree = 123;
|
|||
#define B3 4
|
||||
#endif
|
||||
|
||||
#ifdef __TINYC__
|
||||
/* We try to handle this syntax. Make at least sure it doesn't segfault. */
|
||||
char invalid_function_def()[] {}
|
||||
#endif
|
||||
|
||||
#define __INT64_C(c) c ## LL
|
||||
#define INT64_MIN (-__INT64_C(9223372036854775807)-1)
|
||||
|
||||
|
|
Loading…
Reference in a new issue