Bug 451079: allow setting outparams to null on failure

This commit is contained in:
David Mandelin 2008-08-19 11:17:13 -07:00
parent 14a3c32c99
commit 8c7d60a450
2 changed files with 19 additions and 2 deletions

View File

@ -289,7 +289,9 @@ OutparamCheck.prototype.processAssign = function(isn, state) {
state.assignValue(lhs, makeOutparamAV(rhs), isn);
return;
}
// Cases of this switch that handle something should return from
// the function. Anything that does not return is picked up afteward.
switch (TREE_CODE(rhs)) {
case INTEGER_CST:
if (this.outparams.has(lhs)) {
@ -325,6 +327,20 @@ OutparamCheck.prototype.processAssign = function(isn, state) {
this.processCall(lhs, rhs, isn, state);
}
return;
case INDIRECT_REF:
// If rhs is *outparam and pointer-typed, lhs is NULL iff rhs is
// WROTE_NULL. Required for testcase onull.cpp.
let v = rhs.operands()[0];
if (DECL_P(v) && this.outparams.has(v) &&
TREE_CODE(TREE_TYPE(v)) == POINTER_TYPE) {
state.update(function(ss) {
let val = ss.get(v) == av.WROTE_NULL ? av.ZERO : av.NONZERO;
ss.assignValue(lhs, val, isn);
return [ ss ];
});
return;
}
}
// Nothing special -- delegate

View File

@ -66,7 +66,6 @@ STACK_PASS_TESTCASES = \
OUTPARAMS_WARNING_TESTCASES = \
e1.cpp \
e2.cpp \
e3.cpp \
e4.cpp \
e5.cpp \
e6.cpp \
@ -96,6 +95,8 @@ OUTPARAMS_PASS_TESTCASES = \
o14.cpp \
o15.cpp \
o16.cpp \
onull.cpp \
onull2.cpp \
$(NULL)
STATIC_FAILURE_TESTCASES = \