From 78b448567081b70ea4ccd513388598a867417197 Mon Sep 17 00:00:00 2001 From: Paul Fultz II Date: Mon, 2 Dec 2019 04:35:51 -0600 Subject: [PATCH] Regression for issue 8653: valueFlowAfterCondition: compound conditional (#2416) --- test/testbufferoverrun.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index 844567316..2c6c589be 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -127,6 +127,7 @@ private: TEST_CASE(array_index_46); // #4840 - two-statement for loop TEST_CASE(array_index_47); // #5849 TEST_CASE(array_index_48); // #9478 + TEST_CASE(array_index_49); // #8653 TEST_CASE(array_index_multidim); TEST_CASE(array_index_switch_in_for); TEST_CASE(array_index_for_in_for); // FP: #2634 @@ -1494,6 +1495,20 @@ private: ASSERT_EQUALS("", errout.str()); } + void array_index_49() { + // #8653 + check("void f() {\n" + " int i, k;\n" + " int arr[34] = {};\n" + " i = 1;\n" + " for (k = 0; k < 34 && i < 34; k++) {\n" + " i++;\n" + " }\n" + " arr[k];\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + } + void array_index_multidim() { check("void f()\n" "{\n"