On Thu, Jul 22, 2021 at 01:48:22PM +0530, Harshvardhan Jha wrote: > diff --git a/smatch.h b/smatch.h > index 882e3927..bf88d887 100644 > --- a/smatch.h > +++ b/smatch.h > @@ -72,7 +72,7 @@ struct sm_state { > unsigned short owner; > unsigned short merged:1; > unsigned int line; > - struct smatch_state *state; > + struct smatch_state *state; > struct stree *pool; > struct sm_state *left; > struct sm_state *right; > @@ -302,8 +302,8 @@ do { \ > sm_printf("parse error: "); \ > sm_nr_errors++; \ > } \ > - sm_printf(msg); \ > - sm_printf("\n"); \ > + sm_printf(msg); \ > + sm_printf("\n"); \ These changes are correct but unrelated. > } while (0) > > #define sm_msg(msg...) do { sm_print_msg(0, msg); } while (0) > @@ -848,6 +848,10 @@ enum info_type { > FRESH_ALLOC = 1044, > ALLOCATOR = 1045, > FUNC_TIME = 1047, > + BIT_SET = 1051, > + BIT_CLEAR = 1052, > + BIT_IS_SET = 1053, > + BIT_IS_CLEAR = 1054, > > /* put random temporary stuff in the 7000-7999 range for testing */ > USER_DATA = 8017, > @@ -1317,6 +1321,15 @@ struct bit_info *alloc_bit_info(unsigned long long set, unsigned long long possi > struct smatch_state *alloc_bstate(unsigned long long set, unsigned long long possible); > struct smatch_state *merge_bstates(struct smatch_state *one_state, struct smatch_state *two_state); > > +/* smatch_param_bits_set.c */ > +void __set_param_modified_helper(struct expression *expr, struct smatch_state *state); > +void __set_param_modified_helper_sym(const char *name, struct symbol *sym, > + struct smatch_state *state); > + > +/* smatch_param_bits_clear.c */ > +void __set_param_modified_helper_clear(struct expression *expr, struct smatch_state *state); > +void __set_param_modified_helper_sym_clear(const char *name, struct symbol *sym, > + struct smatch_state *state); > > /* smatch_bit_info.c */ > struct bit_info *rl_to_binfo(struct range_list *rl); > diff --git a/smatch_bits.c b/smatch_bits.c > index 2f92ecd7..555e2c14 100644 > --- a/smatch_bits.c > +++ b/smatch_bits.c > @@ -41,6 +41,17 @@ struct bit_info *alloc_bit_info(unsigned long long set, unsigned long long possi > return bit_info; > } > > +void set_bits_modified_expr(struct expression *expr, struct smatch_state *state) > +{ > + __set_param_modified_helper(expr, state); > + set_state_expr(my_id, expr, state); > +} > + > +void set_bits_modified_expr_sym(const char *name, struct symbol *sym, struct smatch_state *state) > +{ > + __set_param_modified_helper_sym(name, sym, state); > + set_state(my_id, name, sym, state); > +} > struct smatch_state *alloc_bstate(unsigned long long set, unsigned long long possible) > { > struct smatch_state *state; > @@ -151,7 +162,8 @@ static void match_modify(struct sm_state *sm, struct expression *mod_expr) > > if (handled_by_assign_hook(mod_expr)) > return; > - set_state(my_id, sm->name, sm->sym, alloc_bstate(0, -1ULL)); > + > + set_bits_modified_expr_sym(sm->name, sm->sym, alloc_bstate(0, -1ULL)); > } > > int binfo_equiv(struct bit_info *one, struct bit_info *two) > @@ -247,9 +259,9 @@ struct bit_info *get_bit_info(struct expression *expr) > sval_t known; > > expr = strip_parens(expr); > - > - if (get_implied_value(expr, &known)) > + if (get_implied_value(expr, &known)) { > return alloc_bit_info(known.value, known.value); > + } Extra curly braces. > > if (expr->type == EXPR_BINOP) { > if (expr->op == '&') > @@ -334,15 +346,17 @@ static void match_assign(struct expression *expr) > if (is_unknown_binfo(get_type(expr->left), binfo)) > return; > > - set_state_expr(my_id, expr->left, alloc_bstate(binfo->set, binfo->possible)); > + set_bits_modified_expr(expr->left, alloc_bstate(binfo->set, binfo->possible)); > } else if (expr->op == SPECIAL_OR_ASSIGN) { > start = get_bit_info(expr->left); > new = alloc_bstate(start->set | binfo->set, start->possible | binfo->possible); > - set_state_expr(my_id, expr->left, new); > + set_bits_modified_expr(expr->left, new); > + > } else if (expr->op == SPECIAL_AND_ASSIGN) { > start = get_bit_info(expr->left); > new = alloc_bstate(start->set & binfo->set, start->possible & binfo->possible); > - set_state_expr(my_id, expr->left, new); > + set_bits_modified_expr(expr->left, new); > + > } No blank line before a curly brace. > } > > @@ -369,7 +383,6 @@ static void match_condition(struct expression *expr) > > true_info.possible &= right.uvalue; > false_info.possible &= ~right.uvalue; > - Unrelated. > set_true_false_states_expr(my_id, expr->left, > alloc_bstate(true_info.set, true_info.possible), > alloc_bstate(false_info.set, false_info.possible)); > @@ -454,7 +467,42 @@ static void set_param_bits(const char *name, struct symbol *sym, char *key, char Just fix those few small things and resend. regards, dan carpenter