Skip to content

Commit 9212270

Browse files
committed
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
2 parents 29083a7 + 53e04b3 commit 9212270

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

‎inline.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ static struct expression * copy_expression(struct expression *expr)
155155

156156
/* Cast/sizeof/__alignof__ */
157157
case EXPR_CAST:
158+
if (!expr->cast_expression)
159+
return NULL;
158160
if (expr->cast_expression->type == EXPR_INITIALIZER) {
159161
struct expression *cast = expr->cast_expression;
160162
struct symbol *sym = expr->cast_type;

‎tokenize.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ const char *show_token(const struct token *token)
201201
return "end-of-input";
202202

203203
case TOKEN_IDENT:
204+
case TOKEN_ZERO_IDENT:
204205
return show_ident(token->ident);
205206

206207
case TOKEN_NUMBER:
@@ -259,6 +260,7 @@ const char *quote_token(const struct token *token)
259260
return "syntax error";
260261

261262
case TOKEN_IDENT:
263+
case TOKEN_ZERO_IDENT:
262264
return show_ident(token->ident);
263265

264266
case TOKEN_NUMBER:
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
inline void fun(int x)
2+
{
3+
(typeof(@)) x;
4+
}
5+
6+
void foo(void)
7+
{
8+
fun;
9+
}
10+
11+
/*
12+
* check-name: bug-bad-token
13+
* check-exit-value: 0
14+
* check-error-ignore
15+
*/

0 commit comments

Comments
 (0)