Skip to content

Commit 8d97cce

Browse files
committed
Uninitialized variables; Added true positive test
1 parent b61eaec commit 8d97cce

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/testuninitvar.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,12 @@ class TestUninitVar : public TestFixture {
16251625
"}\n");
16261626
ASSERT_EQUALS("", errout.str());
16271627

1628+
checkUninitVar("void foo() {\n"
1629+
" char buf[1024];\n"
1630+
" char x = *(char *) (((uintptr_t) buf + 63) & ~(uintptr_t) 63);\n"
1631+
"}\n");
1632+
ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: buf\n", errout.str());
1633+
16281634
// Passing array to function
16291635
checkUninitVar("void f(int i);\n"
16301636
"void foo()\n"

0 commit comments

Comments
 (0)