misc-ps-region-store-x86_64.m revision 0c106995d52738c4cc0e25edffd6ae2ffaea817d
1// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -checker-cfref --analyzer-store=region --verify -fblocks %s
2
3// This test case appears in misc-ps-region-store-i386.m, but fails under x86_64.
4// The reason is that 'int' is smaller than a pointer on a 64-bit architecture,
5// and we aren't reasoning yet about just the first 32-bits of the pointer.
6typedef struct _BStruct { void *grue; } BStruct;
7void testB_aux(void *ptr);
8void testB(BStruct *b) {
9  {
10    int *__gruep__ = ((int *)&((b)->grue));
11    int __gruev__ = *__gruep__;
12    int __gruev2__ = *__gruep__;
13    if (__gruev__ != __gruev2__) {
14      int *p = 0;
15      *p = 0xDEADBEEF; // no-warning
16    }
17    
18    testB_aux(__gruep__);
19  }
20  {
21    int *__gruep__ = ((int *)&((b)->grue));
22    int __gruev__ = *__gruep__;
23    int __gruev2__ = *__gruep__;
24    if (__gruev__ != __gruev2__) {
25      int *p = 0;
26      *p = 0xDEADBEEF; // expected-warning{{null}}
27    }
28    
29    if (~0 != __gruev__) {}
30  }
31}
32