From 65395aeaa168147c05cb896a60437d9287b4a369 Mon Sep 17 00:00:00 2001 From: Paul Fultz II Date: Sun, 17 Jan 2021 09:29:11 -0600 Subject: [PATCH] Add regression test for 7013: valueFlowAfterCondition: false positive below overspecified code (#3055) --- test/testvalueflow.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 836d70231..768725187 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -2591,6 +2591,16 @@ private: "}\n"; ASSERT_EQUALS(false, testValueOfXImpossible(code, 10U, 1)); ASSERT_EQUALS(false, testValueOfXKnown(code, 10U, 0)); + + code = "int f(int a, int b) {\n" + " if (!a && !b)\n" + " return;\n" + " if ((!a && b) || (a && !b))\n" + " return;\n" + " int x = a;\n" // <- a is _not_ 0 + " return x;\n" + "}\n"; + ASSERT_EQUALS(false, testValueOfX(code, 7U, 0)); } void valueFlowAfterConditionExpr() {