Skip to content

Commit e9c0826

Browse files
Update testbufferoverrun.cpp
1 parent db2457c commit e9c0826

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

test/testbufferoverrun.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5860,6 +5860,26 @@ class TestBufferOverrun : public TestFixture {
58605860
ASSERT_EQUALS("[test.cpp:7:20] -> [test.cpp:9:12]: (error) The address of variable 's.a' is accessed at non-zero index. [objectIndex]\n"
58615861
"[test.cpp:7:20] -> [test.cpp:10:12]: (error) The address of variable 's.a' is accessed at non-zero index. [objectIndex]\n",
58625862
errout_str());
5863+
5864+
check("const int N = 12;\n" // #14887
5865+
"struct S {\n"
5866+
" void f() const;\n"
5867+
" int a[N];\n"
5868+
"};\n"
5869+
"struct T {\n"
5870+
" void f() const;\n"
5871+
" S s;\n"
5872+
"};\n"
5873+
"int g(const int* p) { return p[5]; }\n"
5874+
"void S::f() const {\n"
5875+
" const int* q = a;\n"
5876+
" g(q);\n"
5877+
"}\n"
5878+
"void T::f() const {\n"
5879+
" const int* q = s.a;\n"
5880+
" g(q);\n"
5881+
"}\n");
5882+
ASSERT_EQUALS("", errout_str());
58635883
}
58645884

58655885
void checkPipeParameterSize() { // #3521

0 commit comments

Comments
 (0)