diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index c08f6d139..074182749 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -1724,7 +1724,7 @@ private: errout.str()); } - void array_index_59() + void array_index_59() // #10413 { check("long f(long b) {\n" " const long a[] = { 0, 1, };\n" @@ -1734,6 +1734,22 @@ private: " return a[b];\n" "}\n"); ASSERT_EQUALS("", errout.str()); + + check("void f(int a, int b) {\n" + " const int S[2] = {};\n" + " if (a < 0) {}\n" + " else {\n" + " if (b < 0) {}\n" + " else if (S[b] > S[a]) {}\n" + " }\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + + check("int a[2] = {};\n" + "void f(int i) {\n" + " g(i < 0 ? 0 : a[i]);\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } void array_index_60() diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index e72194af0..e9d25759d 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -2790,7 +2790,7 @@ private: "struct D : public B { int f() override; };\n" "int g(B* p) {\n" " if (p) {\n" - " auto d = dynamic_cast(p);\n" + " auto d = dynamic_cast(p);\n" " return d ? d->f() : 0;\n" " }\n" " return 0;\n"