X-Git-Url: http://andersk.mit.edu/gitweb/splint.git/blobdiff_plain/bb25bea60268559306e8a0fc4d44990ba3ebea32..2934b455c4074408a0f819009c071456f021ba21:/src/constraintResolve.c diff --git a/src/constraintResolve.c b/src/constraintResolve.c index c6ba150..de80027 100644 --- a/src/constraintResolve.c +++ b/src/constraintResolve.c @@ -14,7 +14,6 @@ # include "exprChecks.h" # include "aliasChecks.h" # include "exprNodeSList.h" -//# include "exprData.i" /*@access constraint, exprNode @*/ @@ -70,7 +69,8 @@ static /*@only@*/ constraintList reflectChangesEnsuresFree1 (/*@only@*/ constrai temp = constraintList_subsumeEnsures (list2, ret); temp = constraintList_addList (temp, ret); - + constraintList_free(ret); + DPRINTF(( message ("constraintList_mergeEnsures: returning %s ", constraintList_print(temp) ) )); @@ -109,7 +109,7 @@ static /*@only@*/ constraintList reflectChangesEnsuresFree1 (/*@only@*/ constrai DPRINTF((message ("constraintList_mergeRequires: ret = %s", constraintList_print(ret) ) ) ); - ret = constraintList_addList (ret, temp); + ret = constraintList_addListFree (ret, temp); DPRINTF((message ("constraintList_mergeRequires: returning %s", constraintList_print(ret) ) ) ); @@ -157,7 +157,8 @@ constraintList checkCall (exprNode fcn, exprNodeList arglist) if (preconditions != constraintList_undefined) { - preconditions= constraintList_togglePost (preconditions); + preconditions = constraintList_togglePost (preconditions); + preconditions = constraintList_preserveCallInfo(preconditions, fcn); preconditions = constraintList_doSRefFixConstraintParam (preconditions, arglist); } else @@ -165,7 +166,8 @@ constraintList checkCall (exprNode fcn, exprNodeList arglist) if (preconditions == NULL) preconditions = constraintList_makeNew(); } - + DPRINTF (( message("Done checkCall\n") )); + DPRINTF (( message("Returning list %q ", constraintList_printDetailed(preconditions) ) )); return preconditions; } @@ -454,9 +456,12 @@ static /*@only@*/ constraint doResolveOr (constraint c, constraintList post1, /* if (*resolved) { - constraint_free(next); - constraint_free(ret); - return NULL; + if (next != NULL) + constraint_free(next); + + /*we don't need to free ret when resolved is false*/ + // constraint_free(ret); + /*@i1*/ return NULL; } while (next != NULL) @@ -468,14 +473,18 @@ static /*@only@*/ constraint doResolveOr (constraint c, constraintList post1, /* curr = doResolve (curr, post1, resolved); if (*resolved) { - constraint_free(curr); - constraint_free(next); + /* curr is null so we don't try to free it*/ + //constraint_free(curr); + + if (next != NULL) + constraint_free(next); constraint_free(ret); - return NULL; + /*@i1*/ return NULL; } ret = constraint_addOr (ret, curr); + constraint_free(curr); } - constraint_free(curr); + return ret; } @@ -1078,7 +1087,6 @@ return ret; constraintList_elements(target, el) { constraint temp; - #warning make sure this side effect is the right things #warning make sure that a side effect is not expected temp = substitute(el, subList); @@ -1089,7 +1097,7 @@ return ret; return ret; } -constraint constraint_solve (constraint c) +constraint constraint_solve (/*@returned@*/ constraint c) { DPRINTF( (message ("Solving %s\n", constraint_print(c) ) ) ); c->expr = constraintExpr_solveBinaryExpr (c->lexpr, c->expr);