Add test for #9126 (#3592)

This commit is contained in:
chrchr-github 2021-12-01 18:24:25 +01:00 committed by GitHub
parent 4a1a1534df
commit 6f2000a99b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -2101,6 +2101,18 @@ private:
" }\n"
"}");
ASSERT_EQUALS("[test.cpp:5]: (error) Array 'data[2]' accessed at index 10, which is out of bounds.\n", errout.str());
check("int f() {\n" // #9126
" int i, c;\n"
" char* words[100] = {0};\n"
" g(words);\n"
" for (i = c = 0; (i < N) && (c < 1); i++) {\n"
" if (words[i][0] == '|')\n"
" c++;\n"
" }\n"
" return c;\n"
"}", "test.c");
ASSERT_EQUALS("", errout.str());
}
void array_index_for_continue() {