diff --git a/tccgen.c b/tccgen.c index 4b731f07..a573e6b8 100644 --- a/tccgen.c +++ b/tccgen.c @@ -4180,7 +4180,7 @@ static int parse_btype(CType *type, AttributeDef *ad) u = ad->attr_mode -1; t = (t & ~(VT_BTYPE|VT_LONG)) | u; } - break; + continue; /* GNUC typeof */ case TOK_TYPEOF1: case TOK_TYPEOF2: diff --git a/tests/tests2/82_attribs_position.c b/tests/tests2/82_attribs_position.c index 7c9f9872..7faeaf51 100644 --- a/tests/tests2/82_attribs_position.c +++ b/tests/tests2/82_attribs_position.c @@ -16,4 +16,25 @@ void __attribute__((stdcall)) foo (void) { } -int main () { return 0; } +/* The actual attribute isn't important, must just be + parsable. */ +#define ATTR __attribute__((__noinline__)) +int ATTR actual_function() { + return 42; +} + +extern int printf (const char *, ...); +int main() +{ + void *function_pointer = &actual_function; + + int a = ((ATTR int(*) (void)) function_pointer)(); + printf("%i\n", a); + + /* In the following we once misparsed 'ATTR *' is a btype + and hence the whole type was garbled. */ + int b = ( (int(ATTR *)(void)) function_pointer)(); + printf("%i\n", b); + + return 0; +} diff --git a/tests/tests2/82_attribs_position.expect b/tests/tests2/82_attribs_position.expect index e69de29b..daaac9e3 100644 --- a/tests/tests2/82_attribs_position.expect +++ b/tests/tests2/82_attribs_position.expect @@ -0,0 +1,2 @@ +42 +42