mirror of
https://github.com/frida/tinycc
synced 2024-12-25 06:26:49 +03:00
Don't endlessly recurse on invalid nested typedefs
see testcase.
This commit is contained in:
parent
d00f98a7a5
commit
5ac2a26666
3
tccgen.c
3
tccgen.c
@ -2782,7 +2782,7 @@ ST_FUNC int type_size(CType *type, int *a)
|
||||
*a = PTR_SIZE;
|
||||
return PTR_SIZE;
|
||||
}
|
||||
} else if (IS_ENUM(type->t) && type->ref->c == -1) {
|
||||
} else if (IS_ENUM(type->t) && type->ref->c < 0) {
|
||||
return -1; /* incomplete enum */
|
||||
} else if (bt == VT_LDOUBLE) {
|
||||
*a = LDOUBLE_ALIGN;
|
||||
@ -3934,6 +3934,7 @@ do_decl:
|
||||
next();
|
||||
if (s->c != -1)
|
||||
tcc_error("struct/union/enum already defined");
|
||||
s->c = -2;
|
||||
/* cannot be empty */
|
||||
/* non empty enums are not allowed */
|
||||
ps = &s->next;
|
||||
|
@ -160,4 +160,10 @@ void foo(void) {
|
||||
i = 42.2;
|
||||
}
|
||||
}
|
||||
#elif defined test_nested_types
|
||||
union u {
|
||||
union u {
|
||||
int i;
|
||||
} m;
|
||||
};
|
||||
#endif
|
||||
|
@ -74,3 +74,6 @@
|
||||
|
||||
[test_conflicting_types]
|
||||
60_errors_and_warnings.c:159: error: conflicting types for 'i'
|
||||
|
||||
[test_nested_types]
|
||||
60_errors_and_warnings.c:166: error: struct/union/enum already defined
|
||||
|
Loading…
Reference in New Issue
Block a user