From 19a1ff06aff9963addb982f7854f919ccfaca7a3 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 10 Dec 2012 14:47:26 +0300 Subject: [PATCH] Revert "constraints: fix bug in remove_from_equiv()" This reverts commit 7fed101e3bd7acee4aed04c12fc0deb13a71a048. This causes a seg fault if get_sm_state() returns NULL. The thing is that we want to inherit the implications from equivalent states and so it means that sometimes we will have ->left and ->right where the sm->left->name is not the same as sm->name. The way I see it, this doesn't cause a problem so long as we don't forget this obscure weirdness. Signed-off-by: Dan Carpenter --- smatch_constraints.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/smatch_constraints.c b/smatch_constraints.c index e23b8741..7d2d28f5 100644 --- a/smatch_constraints.c +++ b/smatch_constraints.c @@ -200,14 +200,9 @@ void remove_from_equiv(const char *name, struct symbol *sym) FOR_EACH_PTR(to_update, rel) { struct sm_state *new_sm; - /* - * The trick here is that we want to preserve the implications - * otherwise we could just call: - * set_state(SMATCH_EXTRA, rel->name, rel->sym, state); - */ - - orig_sm = get_sm_state(SMATCH_EXTRA, rel->name, rel->sym); new_sm = clone_sm(orig_sm); + new_sm->name = rel->name; + new_sm->sym = rel->sym; new_sm->state = state; __set_sm(new_sm); } END_FOR_EACH_PTR(rel); -- 2.11.4.GIT