Closed
Description
Affected rules
M0-2-1
Description
The query as currently written only considers overlapping as caused by unions. We should also consider whether overlapping arrays are covered by the same rule.
Example
#include <cstring>
int16_t a[20];
void f2(void) {
std::memcpy(&a[0], &a[1], 10u * sizeof(a[0])); // Non-compliant
std::memmove(&a[0], &a[1], 10u * sizeof(a[0])); // Compliant
std::memcpy(&a[1], &a[0], 10u * sizeof(a[0])); // Non-compliant
std::memmove(&a[1], &a[0], 10u * sizeof(a[0])); // Compliant
}