diff mbox series

[3/5] unqual: comma expressions should drop qualifiers

Message ID 20201118211147.10680-4-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series fix qualifier dropping | expand

Commit Message

Luc Van Oostenryck Nov. 18, 2020, 9:11 p.m. UTC
Comma expressions should be subjected to lvalue-conversion
and thus should drop qualifiers.

Fix this by calling unqualify_type() after array-to-pointer
conversion.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 evaluate.c                     | 2 +-
 validation/eval/unqual-comma.c | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/evaluate.c b/evaluate.c
index fd84205c7f2c..b6e8477185f4 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -1028,7 +1028,7 @@  static struct symbol *evaluate_binop(struct expression *expr)
 
 static struct symbol *evaluate_comma(struct expression *expr)
 {
-	expr->ctype = degenerate(expr->right);
+	expr->ctype = unqualify_type(degenerate(expr->right));
 	if (expr->ctype == &null_ctype)
 		expr->ctype = &ptr_ctype;
 	expr->flags &= expr->left->flags & expr->right->flags;
diff --git a/validation/eval/unqual-comma.c b/validation/eval/unqual-comma.c
index e06586cd43e3..11546d22348a 100644
--- a/validation/eval/unqual-comma.c
+++ b/validation/eval/unqual-comma.c
@@ -9,5 +9,4 @@  int *foo(volatile int x)
 
 /*
  * check-name: unqual-comma
- * check-known-to-fail
  */