diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index c439e9b4f..08eacb509 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -468,7 +468,7 @@ private: if (Token::Match(tok.previous(), "[(,] %var% [+-,)]")) { use(checks, &tok); - use_array(checks, &tok); + //use_array(checks, &tok); return &tok; } diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index 5ad7b8248..983187e21 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -953,6 +953,13 @@ private: " Fred b = a[0];\n" "}\n"); ASSERT_EQUALS("", errout.str()); + + // Ticket #2320 + checkUninitVar("void foo() {\n" + " char a[2];\n" + " char *b = (a+2) & 7;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } // alloc.. @@ -1324,7 +1331,8 @@ private: " int x[10];\n" " calc(x,10);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: x\n", errout.str()); + TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: x\n", errout.str()); + ASSERT_EQUALS("", errout.str()); // using uninitialized function pointer.. checkUninitVar("void foo()\n"