diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-08-23 16:11:27 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-08-23 16:11:27 -0700 |
commit | 658ee8e0f63121c5029d91b4d5df169c6ddfcbb8 (patch) | |
tree | 02b4d677062252ce1f8c3ff21f9669042cc1f94d | |
parent | 18f17cde1e9835bb301e4ca64e0898166b155c90 (diff) | |
download | sparse-658ee8e0f63121c5029d91b4d5df169c6ddfcbb8.tar.gz |
unrestricted values are unrestricted even after a cast
This isn't as tight as it should be, but it basically treats the special
unrestricted constants (zero and all ones) as unrestricted values even
after they have been explicitly cast to teh restricted type.
And yes, this should actually check that type matches too, but I think
all the cases that care will warn about the types not matching
separately anyway.
This is the quick hack.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | evaluate.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -416,6 +416,8 @@ static struct symbol *bad_expr_type(struct expression *expr) static int restricted_value(struct expression *v, struct symbol *type) { + if (v->type == EXPR_CAST) + v = v->cast_expression; if (v->type != EXPR_VALUE) return 1; if (v->value != 0) { |