@@ -127,22 +127,28 @@ class TestString : public TestFixture {
127127
128128 // avoid false positives when the address is modified #6415
129129 check (" void f(void *p, int offset) {\n "
130- " if (!memcmp(p, p+offset, 42)){}\n "
131- " if (!memcmp(p+offset, p, 42)){}\n "
130+ " if (!memcmp(p, p + offset, 42)){}\n "
131+ " if (!memcmp(p + offset, p, 42)){}\n "
132+ " if (!memcmp(offset + p, p, 42)){}\n "
133+ " if (!memcmp(p, offset + p, 42)){}\n "
132134 " }\n " );
133135 ASSERT_EQUALS (" " , errout.str ());
134136
135137 // avoid false positives when the address is modified #6415
136138 check (" void f(char *c, int offset) {\n "
137139 " if (!memcmp(c, c + offset, 42)){}\n "
138- " if (!memcmp(c+ offset, c , 42)){}\n "
140+ " if (!memcmp(c + offset, c, 42)){}\n "
141+ " if (!memcmp(offset + c, c, 42)){}\n "
142+ " if (!memcmp(c, offset + c, 42)){}\n "
139143 " }\n " );
140144 ASSERT_EQUALS (" " , errout.str ());
141145
142146 // avoid false positives when the address is modified #6415
143147 check (" void f(std::string s, int offset) {\n "
144148 " if (!memcmp(s.c_str(), s.c_str() + offset, 42)){}\n "
145149 " if (!memcmp(s.c_str() + offset, s.c_str(), 42)){}\n "
150+ " if (!memcmp(offset + s.c_str(), s.c_str(), 42)){}\n "
151+ " if (!memcmp(s.c_str(), offset + s.c_str(), 42)){}\n "
146152 " }\n " );
147153 ASSERT_EQUALS (" " , errout.str ());
148154
0 commit comments