diff mbox series

[4/5] unqual: statement expressions should drop qualifiers

Message ID 20201118211147.10680-5-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
Statement 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-stmt-expr.c | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/evaluate.c b/evaluate.c
index b6e8477185f4..48ce61f0302d 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -3950,7 +3950,7 @@  struct symbol *evaluate_statement(struct statement *stmt)
 			return NULL;
 		if (stmt->expression->ctype == &null_ctype)
 			stmt->expression = cast_to(stmt->expression, &ptr_ctype);
-		return degenerate(stmt->expression);
+		return unqualify_type(degenerate(stmt->expression));
 
 	case STMT_COMPOUND: {
 		struct statement *s;
diff --git a/validation/eval/unqual-stmt-expr.c b/validation/eval/unqual-stmt-expr.c
index bac6cb6b197f..280c2fe8e36e 100644
--- a/validation/eval/unqual-stmt-expr.c
+++ b/validation/eval/unqual-stmt-expr.c
@@ -9,5 +9,4 @@  int *foo(volatile int x)
 
 /*
  * check-name: unqual-stmt-expr
- * check-known-to-fail
  */