Skip to content

Commit a107e85

Browse files
committed
Add test
1 parent 19de481 commit a107e85

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

test/testuninitvar.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6588,6 +6588,23 @@ class TestUninitVar : public TestFixture {
65886588
" return c.front();\n"
65896589
"}\n");
65906590
ASSERT_EQUALS("[test.cpp:8:12]: (error) Uninitialized variable: c [uninitvar]\n", errout_str());
6591+
6592+
// #13930
6593+
valueFlowUninit("extern int32_t g_items[10U];\n"
6594+
"uint16_t write_item(uint8_t n);\n"
6595+
"uint16_t write_item(uint8_t n) {\n"
6596+
" int32_t *p_item = NULL;\n"
6597+
" uint16_t ret;\n"
6598+
" ret = 0U;\n"
6599+
" if (n < 10U)\n"
6600+
" p_item = &g_items[n];\n"
6601+
" else\n"
6602+
" ret = 1U;\n"
6603+
" if (ret == 0U) \n"
6604+
" *p_item = 5;\n"
6605+
" return ret;\n"
6606+
"}\n");
6607+
ASSERT_EQUALS("", errout_str());
65916608
}
65926609

65936610
void valueFlowUninitBreak() { // Do not show duplicate warnings about the same uninitialized value

0 commit comments

Comments
 (0)