File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments