File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ class TestBufferOverrun : public TestFixture {
131131 TEST_CASE (array_index_48); // #9478
132132 TEST_CASE (array_index_49); // #8653
133133 TEST_CASE (array_index_50);
134+ TEST_CASE (array_index_51); // #3763
134135 TEST_CASE (array_index_multidim);
135136 TEST_CASE (array_index_switch_in_for);
136137 TEST_CASE (array_index_for_in_for); // FP: #2634
@@ -1525,6 +1526,14 @@ class TestBufferOverrun : public TestFixture {
15251526 ASSERT_EQUALS (" " , errout.str ());
15261527 }
15271528
1529+ void array_index_51 () {
1530+ check (" void f(void){\n "
1531+ " int k=0, dd, d[1U] = {1};\n "
1532+ " for (dd=d[k]; k<10; dd=d[++k]){;}\n "
1533+ " }" );
1534+ ASSERT_EQUALS (" [test.cpp:3]: (error) Array 'd[1]' accessed at index 1, which is out of bounds.\n " , errout.str ());
1535+ }
1536+
15281537 void array_index_multidim () {
15291538 check (" void f()\n "
15301539 " {\n "
You can’t perform that action at this time.
0 commit comments