QualType elementType;
if (const ElementRegion *elemReg = dyn_cast<ElementRegion>(region)) {
- index = evalBinOpNN(state, BO_Add, elemReg->getIndex(), rhs,
+ assert(op == BO_Add || op == BO_Sub);
+ index = evalBinOpNN(state, op, elemReg->getIndex(), rhs,
getArrayIndexType());
superR = elemReg->getSuperRegion();
elementType = elemReg->getElementType();
return y.x; // no-warning
}
+// Test correct pointer arithmetic using 'p--'. This is to warn that we
+// were loading beyond the written characters in buf.
+char *RDar9269695(char *dst, unsigned int n)
+{
+ char buff[40], *p;
+
+ p = buff;
+ do
+ *p++ = '0' + n % 10;
+ while (n /= 10);
+
+ do
+ *dst++ = *--p; // no-warning
+ while (p != buff);
+
+ return dst;
+}
+
+