aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2022-06-27 02:31:32 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2022-06-27 14:03:49 +0200
commita20ea60c1a18256f9e3b84d3781778067808aa50 (patch)
tree08cfaee76b9fc9c9f7ce68402389d02de4f4f2a2
parentf8f08b3336e380ed1af5f731cc465fe710e64eec (diff)
downloadsparse-a20ea60c1a18256f9e3b84d3781778067808aa50.tar.gz
bitwise: allow compares for bitwise types
Currently, bitwise types are restricted to bitwise operations (&, |, ^ and ~) as well as equality comparisons. This patch makes the others comparisons valid for bitwise types too. Warning: This change make sense in the context of [1] but doesn't make sense for the 'main' bitwise types: __be32 and friends. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--evaluate.c4
-rw-r--r--validation/bitwise-cmp.c1
-rw-r--r--validation/linear/bitwise-cmps.c1
3 files changed, 4 insertions, 2 deletions
diff --git a/evaluate.c b/evaluate.c
index bcbcdf1e..bb8c0caa 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -435,6 +435,10 @@ static int restricted_binop(int op, struct symbol *type)
case '^':
case '?':
return 2; /* keep fouled */
+ case '<':
+ case '>':
+ case SPECIAL_LTE:
+ case SPECIAL_GTE:
case SPECIAL_EQUAL:
case SPECIAL_NOTEQUAL:
return 3; /* warn if fouled */
diff --git a/validation/bitwise-cmp.c b/validation/bitwise-cmp.c
index ca12b5e5..8c3e6894 100644
--- a/validation/bitwise-cmp.c
+++ b/validation/bitwise-cmp.c
@@ -28,5 +28,4 @@ static int gtx(b32 x, b32 y) { return (x > y); }
/*
* check-name: bitwise-cmp
- * check-known-to-fail
*/
diff --git a/validation/linear/bitwise-cmps.c b/validation/linear/bitwise-cmps.c
index 6122944a..f83ab7fe 100644
--- a/validation/linear/bitwise-cmps.c
+++ b/validation/linear/bitwise-cmps.c
@@ -8,7 +8,6 @@ static int gtu(bs32 x, bs32 y) { return (x > y); }
/*
* check-name: bitwise-cmps
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-ignore
* check-output-excludes: setb\\.