Verification; Fix struct member false negative

This commit is contained in:
Daniel Marjamäki 2020-01-12 10:28:48 +01:00
parent 26e403893c
commit 7704f6578f
2 changed files with 10 additions and 4 deletions

View File

@ -1292,7 +1292,9 @@ static ExprEngine::ValuePtr executeDot(const Token *tok, Data &data)
}
}
call(data.callbacks, tok->astOperand1(), structValue, &data);
return structValue->getValueOfMember(tok->astOperand2()->str());
ExprEngine::ValuePtr memberValue = structValue->getValueOfMember(tok->astOperand2()->str());
call(data.callbacks, tok, memberValue, &data);
return memberValue;
}
static ExprEngine::ValuePtr executeBinaryOp(const Token *tok, Data &data)
@ -1750,7 +1752,7 @@ void ExprEngine::executeFunction(const Scope *functionScope, const Tokenizer *to
call(callbacks, tok, bailoutValue, &data);
}
if (settings->debugVerification && (callbacks.empty() || !trackExecution.isAllOk())) {
if (settings->debugVerification && (settings->verbose || callbacks.empty() || !trackExecution.isAllOk())) {
if (!settings->verificationReport.empty())
report << "[debug]" << std::endl;
trackExecution.print(report);

View File

@ -27,7 +27,7 @@ def get_error_lines(filename):
f = open(filename, 'rt')
lines = f.readlines()
for linenr, line in enumerate(lines):
if line.find('/* ERROR:') > 0:
if line.find('/* ERROR:') > 0 or line.find('/*ERROR:') > 0:
ret.append(linenr+1)
return ret
@ -43,9 +43,13 @@ def check(filename):
stdout = comm[0].decode(encoding='utf-8', errors='ignore')
stderr = comm[1].decode(encoding='utf-8', errors='ignore')
w = r'.*zero_division.c:([0-9]+):[0-9]+: error: There is division.*'
if TESTFILE.find('uninit_') > 0:
w = r'.*c:([0-9]+):[0-9]+: error: .*verificationUninit.*'
ret = []
for line in stderr.split('\n'):
res = re.match(r'.*zero_division.c:([0-9]+):[0-9]+: error: There is division.*', line)
res = re.match(w, line)
if res is None:
continue
ret.append(int(res.group(1)))