2008-10-01 13:05:46 +08:00
|
|
|
// RUN: clang -checker-cfref --verify %s
|
|
|
|
|
|
|
|
// Reduced test case from crash in <rdar://problem/6253157>
|
|
|
|
@class NSObject;
|
|
|
|
@interface A @end
|
|
|
|
@implementation A
|
|
|
|
- (void)foo:(void (^)(NSObject *x))block {
|
|
|
|
if (!((block != ((void *)0)))) {}
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
2008-10-19 06:20:20 +08:00
|
|
|
// Reduced test case from crash in PR 2796;
|
|
|
|
// http://llvm.org/bugs/show_bug.cgi?id=2796
|
|
|
|
|
|
|
|
unsigned foo(unsigned x) { return __alignof__((x)) + sizeof(x); }
|
2008-10-21 07:14:31 +08:00
|
|
|
|
|
|
|
// Improvement to path-sensitivity involving compound assignments.
|
|
|
|
// Addresses false positive in <rdar://problem/6268365>
|
|
|
|
//
|
|
|
|
|
|
|
|
unsigned r6268365Aux();
|
|
|
|
|
|
|
|
void r6268365() {
|
|
|
|
unsigned x = 0;
|
|
|
|
x &= r6268365Aux();
|
|
|
|
unsigned j = 0;
|
|
|
|
|
|
|
|
if (x == 0) ++j;
|
|
|
|
if (x == 0) x = x / j; // no-warning
|
|
|
|
}
|
|
|
|
|
2008-10-21 07:40:25 +08:00
|
|
|
void divzeroassume(unsigned x, unsigned j) {
|
|
|
|
x /= j;
|
|
|
|
if (j == 0) x /= 0; // no-warning
|
|
|
|
if (j == 0) x /= j; // no-warning
|
|
|
|
if (j == 0) x = x / 0; // no-warning
|
|
|
|
}
|
|
|
|
|
|
|
|
void divzeroassumeB(unsigned x, unsigned j) {
|
|
|
|
x = x / j;
|
|
|
|
if (j == 0) x /= 0; // no-warning
|
|
|
|
if (j == 0) x /= j; // no-warning
|
|
|
|
if (j == 0) x = x / 0; // no-warning
|
|
|
|
}
|
|
|
|
|
2008-10-26 04:09:21 +08:00
|
|
|
// PR 2948 (testcase; crash on VisitLValue for union types)
|
|
|
|
// http://llvm.org/bugs/show_bug.cgi?id=2948
|
|
|
|
|
|
|
|
void checkaccess_union() {
|
|
|
|
int ret = 0, status;
|
|
|
|
if (((((__extension__ (((union {
|
|
|
|
__typeof (status) __in; int __i;}
|
|
|
|
)
|
|
|
|
{
|
|
|
|
.__in = (status)}
|
|
|
|
).__i))) & 0xff00) >> 8) == 1)
|
|
|
|
ret = 1;
|
|
|
|
}
|
2008-11-13 13:05:34 +08:00
|
|
|
|
|
|
|
// InitListExpr processing
|
|
|
|
|
|
|
|
typedef float __m128 __attribute__((__vector_size__(16), __may_alias__));
|
|
|
|
__m128 return128() {
|
|
|
|
return __extension__(__m128) { 0.0f, 0.0f, 0.0f, 0.0f };
|
|
|
|
}
|
|
|
|
|