Fix issue 9667: crash: crash in valueflow for weird code where label address is returned (#2602)
This commit is contained in:
parent
e8e3c2660d
commit
8b27f1c216
|
@ -34,7 +34,7 @@ struct ForwardTraversal {
|
||||||
if (out)
|
if (out)
|
||||||
*out = tok->link();
|
*out = tok->link();
|
||||||
return Progress::Skip;
|
return Progress::Skip;
|
||||||
} else if (Token::Match(tok, "?|&&|%oror%")) {
|
} else if (Token::Match(tok, "?|&&|%oror%") && tok->astOperand1() && tok->astOperand2()) {
|
||||||
if (traverseConditional(tok, f, traverseUnknown) == Progress::Break)
|
if (traverseConditional(tok, f, traverseUnknown) == Progress::Break)
|
||||||
return Progress::Break;
|
return Progress::Break;
|
||||||
if (out)
|
if (out)
|
||||||
|
|
|
@ -4488,6 +4488,16 @@ private:
|
||||||
" };\n"
|
" };\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
valueOfTok(code, "x");
|
valueOfTok(code, "x");
|
||||||
|
|
||||||
|
code = "void *foo(void *x);\n"
|
||||||
|
"void *foo(void *x)\n"
|
||||||
|
"{\n"
|
||||||
|
" if (!x)\n"
|
||||||
|
"yes:\n"
|
||||||
|
" return &&yes;\n"
|
||||||
|
" return x;\n"
|
||||||
|
"}\n";
|
||||||
|
valueOfTok(code, "x");
|
||||||
}
|
}
|
||||||
|
|
||||||
void valueFlowHang() {
|
void valueFlowHang() {
|
||||||
|
|
Loading…
Reference in New Issue