Don't clone all the states for every case statement.
commit78f1a8f022faa3f661e14b2b8fc0c803d46058e1
authorDan Carpenter <error27@gmail.com>
Fri, 8 May 2009 17:32:02 +0000 (8 20:32 +0300)
committerDan Carpenter <error27@gmail.com>
Fri, 8 May 2009 17:32:02 +0000 (8 20:32 +0300)
tree53b0fed9b0f57b407475b12a3678ea91adf0ea55
parentffcd0e5e108f326be503a26f29f080e702dbf6b4
Don't clone all the states for every case statement.

Smatch was running out of memory a lot because it did a
clone_slist_and_states() for every case statement.  With this change we
only clone the states right before we do a merge.

This change does make validation/sm_switch.c fail.

The problem with that switch is that we want to say if, "if x is not 1
and not 2 then we can eliminate these paths."  But we actually check
it separately, "if x is not 1 we eliminate this path.  If x is not 2 we
eliminate this other path", but we don't check the compound condition.

Switch statement are a bit different from if statements.  If we did an
if (x == 3)
        c->a = 1;
the test would actually pass.

I will fix this asap obviously.

Signed-off-by: Dan Carpenter <error27@gmail.com>
smatch_implied.c
smatch_slist.c
smatch_slist.h
smatch_states.c
validation/sm_switch.c