2 // RUN: %clang_analyze_cc1 -w -fcxx-exceptions -analyzer-checker=core -analyzer-checker=alpha.core.PointerArithm,alpha.core.CastToStruct -analyzer-max-loop 64 -verify %s
3 // RUN: %clang_analyze_cc1 -w -analyzer-checker=core -analyzer-checker=cplusplus -fcxx-exceptions -analyzer-checker alpha.core.PointerArithm,alpha.core.CastToStruct -analyzer-max-loop 63 -verify %s
5 // These tests used to hit an assertion in the bug report. Test case from http://llvm.org/PR24184.
11 typedef enum { DT_NONCE_FIXED
} DATA_TYPE
;
13 typedef int *vcreate_t(int *, DATA_TYPE
, int, int);
14 void fn1(unsigned, unsigned) {
16 for (; 1; a
++, &b
+ a
* 0)
22 CRYPT_DATA_BLOB value
;
36 void m_fn3(B
*, int, int, int);
40 int e
= p1
->IkeHashAlg
.m_fn1();
41 unsigned f
= p1
->IkeGType
.m_fn1(), h
;
43 d
= fn2(0, DT_NONCE_FIXED
, (char)0, p1
->NoncePhase1_r
.value
.cbData
);
51 unsigned char *pbData
;
53 typedef unsigned uint32_t;
54 void fn1_1(void *p1
, const void *p2
) { p1
!= p2
; }
56 void fn2_1(uint32_t *p1
, unsigned char *p2
, uint32_t p3
) {
59 fn1_1(p1
+ i
, p2
+ i
* 0);
63 CRYPT_DATA_BLOB_1 value
;
67 fn2_1(&a
, value
.pbData
, value
.cbData
);
76 d
= b
->HashAlgId
.m_fn1();
89 ST
*p1
= (ST
*)(p
); // expected-warning{{Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption}}
90 while (p1
->c
& 0x0F || p1
->c
& 0x07)