Skip to contentSkip to conversation

power_of_two: Track variables which are powers of two

PATCH New Harshvardhan Jha 1 participant 1 message Jul 20, 2021 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power_of_two: Track variables which are powers of two

smatch_power_of_two tracks variables which are powers of two and also handles exceptions such as sign extensions.

---
 Makefile              |   1 +
 check_list.h          |   1 +
 smatch.h              |   2 +
 smatch_power_of_two.c | 167 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 171 insertions(+)
 create mode 100644 smatch_power_of_two.c
Makefile +1 -0
index 8855c974..9a677990 100644
@@ -303,6 +303,7 @@ SMATCH_OBJS += smatch_parse_call_math.o
 SMATCH_OBJS += smatch_parsed_conditions.o
 SMATCH_OBJS += smatch_passes_array_size.o
 SMATCH_OBJS += smatch_points_to_user_data.o
+SMATCH_OBJS += smatch_power_of_two.o
 SMATCH_OBJS += smatch_project.o
 SMATCH_OBJS += smatch_ranges.o
 SMATCH_OBJS += smatch_real_absolute.o
check_list.h +1 -0
index fd205269..b555557b 100644
@@ -57,6 +57,7 @@ CK(register_integer_overflow_links)
 CK(register_real_absolute)
 CK(register_imaginary_absolute)
 CK(register_bits)
+CK(register_power_of_two)
 CK(register_fn_arg_link)
 CK(register_parameter_names)
 CK(register_return_to_param)
smatch.h +2 -0
index 025ad1a8..35a6be7a 100644
@@ -848,6 +848,8 @@ enum info_type {
 	FRESH_ALLOC	= 1044,
 	ALLOCATOR	= 1045,
 	FUNC_TIME	= 1047,
+	POWER_OF_TWO	= 1048,
+	POWER_OF_TWO_SET = 1049,
 
 	/* put random temporary stuff in the 7000-7999 range for testing */
 	USER_DATA	= 8017,
smatch_power_of_two.c new file +167 -0

167 lines not on this page · raw message

Signature · 1 line
2.32.0