return;
delete p2;
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"><a href="http://llvm.org/bugs/show_bug.cgi?id=15237">PR15237</a>
+</td></tr>
<tr><td><span class="name">memory.MismatchedFree
<br>enhancement to unix.Malloc<br>(C, C++)</span><br><br>
free(p1); // warn
free(p2); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"><a href="http://llvm.org/bugs/show_bug.cgi?id=15238">PR15238</a>
+</td></tr>
<tr><td><span class="name">memory.MismatchedDelete
<br>(C, C++)</span><br><br>
delete p2; // warn
delete p3; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"><a href="http://llvm.org/bugs/show_bug.cgi?id=15238">PR15238</a>
+</td></tr>
<tr><td><span class="name">memory.MultipleDelete
<br>(C++)</span><br><br>
delete p2; // warn
delete p3; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"><a href="http://llvm.org/bugs/show_bug.cgi?id=15237">PR15237</a>
+</td></tr>
+
<tr><td><span class="name">memory.LeakPtrValChanged
<br>enhancement to unix.Malloc<br>(C, C++)</span><br><br>
f(p4);
p4++; // ok
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned">done at r174678
+</td></tr>
+
<tr><td><span class="name">memory.DeallocateNonPtr
<br>enhancement to unix.Malloc<br>(C, C++)</span><br><br>
delete s; // warn
free(s); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"><a href="http://llvm.org/bugs/show_bug.cgi?id=15237">PR15237</a>
+</td></tr>
+
<tr><td><span class="name">memory.LeakEvalOrder<br>
(C, C++)</span><br><br>
f1(g((int *)malloc(sizeof(int))), h()); // warn
f2(new int, new int);
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">memory.DstBufferTooSmall
<br>(C, C++)</span><br><br>
int* p2 = new int;
memcpy(p2, p1, 3); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">memory.NegativeArraySize
<br>enhancement to experimental.security.MallocOverflow<br>(C, C++)
int n1 = -1;
p = new int[n1]; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
</table>
A() {}
~A() { throw 1; } // warn
};
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">ctordtor.ExptInsideDtorImplicit<br>
(C++)</span><br><br>
A() {}
~A() { f(); } // warn
};
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
</table>
</td><td><pre>
void f() throw(int) { // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">exceptions.NoThrowSpecButThrows
<br>(C++)</span><br><br>
void f() throw() {
throw(1); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">exceptions.ThrownTypeDiffersSpec
<br>(C++)</span><br><br>
S s;
throw (s); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
</table>
std::auto_ptr<int>
p3((int *)malloc(sizeof(int))); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
</table>
};
A a;
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.LocalStaticDestroyed
<br>(C++)</span><br><br>
void f() {
static B b; // <-
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.UseAfterRelease
<br>enhancement to unix.Malloc<br>(C, C++)</span><br><br>
int i = *p; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.ZeroAllocDereference
<br>enhancement to unix.Malloc<br>(C, C++)</span><br><br>
int *p = new int[0];
int i = p[0]; // warn
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.DeadReferenced
<br>(C++)</span><br><br>
dynamic_cast<A*>(b); // warn
delete b; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.ObjLocChanges
<br>(C++)</span><br><br>
new (&b2) T;
delete b1; // warn
} // warn
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.ExprEvalOrderUndef
<br>(C, C++03)</span><br><br>
i = v[i++]; // warn
i = ++i + 1; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.StaticInitReentered
<br>(C)</span><br><br>
static int s = test(2*i); // warn
return i+1;
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.ConstModified
<br>(C, C++)</span><br><br>
p->x.i = 1; // ok
p->x.j = 1; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.DeadDestructed
<br>(C++)</span><br><br>
A a;
a.~A();
} // warn
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.MethodCallBeforeBaseInit
<br>(C++)</span><br><br>
int f();
B() : A(f()) {} // warn
};
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.MemberOrBaseRefBeforeCtor
<br>(C++)</span><br><br>
non_trivial nt;
S() : k(&nt.j) {} // warn
};
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.MemberRefAfterDtor
<br>(C++)</span><br><br>
s->~S();
s->f(); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.CtorForeignCall
<br>(C++)</span><br><br>
public:
C() : B((A*)this) {}
};
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.CtorForeignCast
undefbehavior.CtorForeignTypeid
public:
C() : B((A*)this) {}
};
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.MemberRefInCatch
undefbehavior.BaseRefInCatch
i=2; // warn
}
};
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.ReturnAtCatchEnd
<br>(C++)</span><br><br>
}
catch(int) {
} // warn
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.AutoptrsOwnSameObj
<br>(C++03)</span><br><br>
std::auto_ptr<int> p(data);
std::auto_ptr<int> q(data); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.BasicStringBoundAccess
<br>(C++03)</span><br><br>
std::basic_string<char> s;
char c = s[10]; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.BasicStringBoundModification
<br>(C++)</span><br><br>
std::basic_string<char> s;
s[10] = 0; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.EosDereference
<br>(C++)</span><br><br>
int i = *v.end(); // warn
*v.end() = 0; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.QsortNonPOD
undefbehavior.QsortNonTrivial
qsort(nt, 2, sizeof(non_trivial),
compare2); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.ThrowWhileCopy
<br>C++</span><br><br>
j = s.j;
}
};
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.ValarrayArgBound
<br>(C++)</span><br><br>
S s[] = { S(1), S(2) };
std::valarray<S> v(s,3); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.ValarrayLengthDiffer
<br>(C++)</span><br><br>
b.resize(1);
a = b; // OK
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.ValarrayZeroLength
<br>(C++)</span><br><br>
v.min(); // warn
v.max(); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.ValarrayBadIndirection
<br>(C++)</span><br><br>
a[indirect] = b; //warn
a[indirect] *= b; //warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.IosBaseDestroyedBeforeInit
<br>(C++)</span><br>
delete p1; // warn
delete p2; // ok
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.IosBaseUsedBeforeInit
<br>(C++11)</span><br><br>
delete p1; // warn
delete p2; // ok
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">undefbehavior.MinusOnePosType
<br>(C++)</span><br><br>
in.seekg(pos); // warn
out.seekp(-1); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
</table>
<!-- ============================ different ================================ -->
int v[1] = {0};
f(v[i], i++); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.IdenticalExprBinOp
<br>(C)</span><br><br>
if (f() && f()) {} // ok
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.FuncPtrInsteadOfCall
<br>(C)</span><br><br>
void test() {
if (f == 0) {} // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.IdenticalCondIfElseIf
<br>(C)</span><br><br>
if (i == 1) {}
else if (i == 1) {} // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">SuccessiveAssign
<br>(C)</span><br><br>
i=1;
i=2; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.NullDerefStmtOrder
<br>enhancement to core.NullDereference<br>(C)</span><br><br>
S *p2 = f();
int x2 = p2->x; // ok
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.NullDerefCondOrder
<br>enhancement to core.NullDereference<br>(C)</span><br><br>
S *p = f();
if (p->b && p) {}; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.IdenticalStmtThenElse
<br>(C)</span><br><br>
i++;
}
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.MultipleAccessors
<br>(C++)</span><br><br>
void setI(int& ii) { i = ii; }
void setJ(int& jj) { i = jj; } // warn
};
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.AccessorsForPublic
<br>(C++)</span><br><br>
int getI() { return i; }
void setI(int& ii) { i = ii; }
};
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.LibFuncResultUnised
<br>(C, C++)</span><br><br>
std::vector<int> v;
v.empty(); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.WrongVarForStmt
<br>(C, C++)</span><br><br>
for (j=0; j<3; ++i); // warn
for (int j=0; i<3; ++j); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.FloatingCompare
<br>(C)</span><br><br>
if (b == 0.5) // warn
b = 0;
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.BoolCompare
<br>maybe merge with experimental.core.BoolAssignment<br>(C, C++)</span><br><br>
bool b;
if (b == 3) {}; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.BitwiseOpBoolArg
<br>maybe join with experimental.core.BoolAssignment<br>(C, C++)</span><br><br>
bool b = true;
if (b & f()) {} // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.LabelInsideSwitch
<br>(C)</span><br><br>
c -= 1; break;
}
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.IdenticalCondIfIf
<br>(C)</span><br><br>
if (c > 5) // warn
c -= 1;
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.CondOpIdenticalReturn
<br>(C)</span><br><br>
unsigned a;
a = a > 5 ? a : a; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.UnaryPlusWithUnsigned
<br>(C)</span><br><br>
unsigned a;
a = +a; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.LogicalOpUselessArg
<br>(C)</span><br><br>
unsigned a;
if (a<7 && a<10) {}; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.SameResLogicalExpr
<br>(C)</span><br><br>
if (i==0 && i==1) {}; // warn
if (i<0 || i>=0) {}; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.SameResUnsignedCmp
<br>(C)</span><br><br>
if (u < -1) {}; // warn
if (u >= 0) {}; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.OpPrecedenceAssignCmp
<br>(C)</span><br><br>
if((b = x != y)) {} // ok
if((x = f() != y)) {} // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.OpPrecedenceIifShift
<br>(C)</span><br><br>
std::cout << a ? "a" : "b"; // warn
a << a>7 ? 1 : 2; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.ObjectUnused
<br>(C++)</span><br><br>
S(0, 0); // warn
std::exception(); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.StaticArrayPtrCompare
<br>(C)</span><br><br>
int a2[1][1];
if (a2[0]) {}; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.ConversionToBool
<br>maybe join with experimental.core.BoolAssignment<br>(C, C++)</span><br><br>
return 1.; // warn
return ""; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.ArrayBound
<br>enhancement to experimental.security.ArrayBound[v2]<br>(C, C++)</span><br><br>
int i = 1;
if(p2[i]) {}; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.StrcpyInputSize
<BR>enhancement to experimental.unix.cstring.OutOfBounds<br>(C)</span><br><br>
char buf[24];
strcpy(buf, string); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.IntegerOverflow
<br>(C)</span><br><br>
int y = INT_MAX/2+1; // warn
x = y*2; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.SignExtension
<br>(C)</span><br><br>
ui = g(); // warn
return si; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.NumericTruncation
<br>(C)</span><br><br>
ss = g(); // warn
return sll; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">different.MissingCopyCtorAssignOp
<br>(C, C++)</span><br><br>
C() { p = new int; }
~C() { delete p; }
};
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
</table>
NULL, TEXT("MyProgram.exe"), NULL, NULL,
TRUE, 0, NULL, NULL, &si, &pi);
} // warn
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">WinAPI.LoadLibrary
<br>(C)</span><br><br>
void test() {
HINSTANCE h = LoadLibrary("X.dll"); // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">WinAPI.WideCharToMultiByte
<br>(C)</span><br><br>
else
s[res2] = 0;
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
</table>
bool FirstIsZero(const struct A a) { // warn
return a.a[0] == 0;
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">optimization.PostfixIncIter
<br>(C++)</span><br><br>
for(it = v.begin();
it != v.end(); it++) {}; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">optimization.MultipleCallsStrlen
<br>(C)</span><br><br>
if (strlen(s) > 0 &&
strlen(s) < 7) {}; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">optimization.EmptyCstrDetect
<br>(C)</span><br><br>
const char* s = "abc";
if (strlen(s) > 0) {}; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">optimization.StrLengthCalculation
<br>(C, C++)</span><br><br>
std::string s;
if (strlen(s.c_str()) != 0) {}; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
<tr><td><span class="name">optimization.EmptyContainerDetect
<br>(C, C++)</span><br><br>
std::list<int> l;
if (l.size() != 0) {}; // warn
}
-</pre></td><td></td></tr>
+</pre></td><td class="aligned"></td></tr>
</table>