[PATCH 5/5] unqual: pre- & post-increment/decrement should *not* drop qualifiers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Increment and decrement expressions are not subjected to lvalue-conversion
and thus should *not* drop qualifiers.

However, while the lvalue-conversion is not done, the qualifiers
are dropped because the type used for the result is the one returned
by classify_type() which always return the base type.

Fix this by using the type of the operand as the result type.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 evaluate.c                      | 3 +--
 validation/eval/unqual-postop.c | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/evaluate.c b/evaluate.c
index 48ce61f0302d..8599fcee6875 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -1935,8 +1935,7 @@ static struct symbol *evaluate_postop(struct expression *expr)
 	if (multiply) {
 		evaluate_assign_to(op, op->ctype);
 		expr->op_value = multiply;
-		expr->ctype = ctype;
-		return ctype;
+		return expr->ctype = op->ctype;
 	}
 
 	expression_error(expr, "bad argument type for ++/--");
diff --git a/validation/eval/unqual-postop.c b/validation/eval/unqual-postop.c
index fb3082dc8836..48b6be8b8508 100644
--- a/validation/eval/unqual-postop.c
+++ b/validation/eval/unqual-postop.c
@@ -10,7 +10,6 @@ static void test_volatile(void)
 /*
  * check-name: unqual-postop
  * check-command: sparse -Wno-declaration-after-statement $file
- * check-known-to-fail
  *
  * check-error-start
 eval/unqual-postop.c:6:40: warning: incorrect type in assignment (different modifiers)
-- 
2.29.2




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux