From 4c18967329acbed3d59808212e28388361ae21a0 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Sun, 31 Aug 2014 21:45:38 +0200 Subject: [PATCH] Added unit test for #5849 --- test/testbufferoverrun.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index 1a552e90f..dbc3e6dae 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -171,6 +171,7 @@ private: TEST_CASE(array_index_44); // #3979 TEST_CASE(array_index_45); // #4207 - calling function with variable number of parameters (...) TEST_CASE(array_index_46); // #4840 - two-statement for loop + TEST_CASE(array_index_47); // #5849 TEST_CASE(array_index_multidim); TEST_CASE(array_index_switch_in_for); TEST_CASE(array_index_for_in_for); // FP: #2634 @@ -1598,6 +1599,16 @@ private: ASSERT_EQUALS("", errout.str()); } + void array_index_47() { + // #5849 + check("int s[4];\n" + "void f() {\n" + " for (int i = 2; i < 0; i++)\n" + " s[i] = 5; \n" + "}"); + ASSERT_EQUALS("", errout.str()); + } + void array_index_multidim() { check("void f()\n" "{\n"