diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2022-06-09 11:11:09 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2022-06-09 11:11:09 +0200 |
commit | 9212270048c3bd23f56c20a83d4f89b870b2b26e (patch) | |
tree | 3785b539c4787497f38770cd6fbc3b56afe226ba | |
parent | 29083a76efa600b02d30f32d0393ae53e37887f8 (diff) | |
parent | 53e04b3b780bbcf2dd3eb7990c17414742bbfef9 (diff) | |
download | sparse-9212270048c3bd23f56c20a83d4f89b870b2b26e.tar.gz |
Merge branches 'cgcc-dash-x' and 'fixes'
* cgcc: do not die on '-x assembler'
* fix crash when inlining casts of erroneous expressions
- allow show_token() on TOKEN_ZERO_IDENT
-rw-r--r-- | inline.c | 2 | ||||
-rw-r--r-- | tokenize.c | 2 | ||||
-rw-r--r-- | validation/inline-early/bug-bad-token.c | 15 |
3 files changed, 19 insertions, 0 deletions
@@ -155,6 +155,8 @@ static struct expression * copy_expression(struct expression *expr) /* Cast/sizeof/__alignof__ */ case EXPR_CAST: + if (!expr->cast_expression) + return NULL; if (expr->cast_expression->type == EXPR_INITIALIZER) { struct expression *cast = expr->cast_expression; struct symbol *sym = expr->cast_type; @@ -201,6 +201,7 @@ const char *show_token(const struct token *token) return "end-of-input"; case TOKEN_IDENT: + case TOKEN_ZERO_IDENT: return show_ident(token->ident); case TOKEN_NUMBER: @@ -259,6 +260,7 @@ const char *quote_token(const struct token *token) return "syntax error"; case TOKEN_IDENT: + case TOKEN_ZERO_IDENT: return show_ident(token->ident); case TOKEN_NUMBER: diff --git a/validation/inline-early/bug-bad-token.c b/validation/inline-early/bug-bad-token.c new file mode 100644 index 00000000..9049bdb4 --- /dev/null +++ b/validation/inline-early/bug-bad-token.c @@ -0,0 +1,15 @@ +inline void fun(int x) +{ + (typeof(@)) x; +} + +void foo(void) +{ + fun; +} + +/* + * check-name: bug-bad-token + * check-exit-value: 0 + * check-error-ignore + */ |