From 081785f702de02aa131e416a9a751db34a2a5412 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 27 Jul 2007 11:57:06 -0400 Subject: [PATCH] [PATCH] ...,array should degenerate Signed-off-by: Al Viro --- evaluate.c | 4 +++- validation/comma.c | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 validation/comma.c diff --git a/evaluate.c b/evaluate.c index d48fbbe8..5cb1b895 100644 --- a/evaluate.c +++ b/evaluate.c @@ -969,7 +969,9 @@ static struct symbol *evaluate_binop(struct expression *expr) static struct symbol *evaluate_comma(struct expression *expr) { - expr->ctype = expr->right->ctype; + expr->ctype = degenerate(expr->right); + if (expr->ctype == &null_ctype) + expr->ctype = &ptr_ctype; expr->flags &= expr->left->flags & expr->right->flags; return expr->ctype; } diff --git a/validation/comma.c b/validation/comma.c new file mode 100644 index 00000000..f62e0121 --- /dev/null +++ b/validation/comma.c @@ -0,0 +1,10 @@ +static char a[sizeof(char *) + 1]; +static char b[1/(sizeof(a) - sizeof(0,a))]; +/* + * check-name: Comma and array decay + * check-description: arguments of comma should degenerate + * check-command: sparse $file + * + * check-output-start + * check-output-end + */ -- 2.11.4.GIT