xref: /minix3/external/bsd/llvm/dist/clang/test/Analysis/rdar-6442306-1.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core %s -analyzer-store=region -verify
2*f4a2713aSLionel Sambuc// expected-no-diagnostics
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuctypedef int bar_return_t;
5*f4a2713aSLionel Sambuctypedef struct {
6*f4a2713aSLionel Sambuc  unsigned char int_rep;
7*f4a2713aSLionel Sambuc} Foo_record_t;
8*f4a2713aSLionel Sambucextern Foo_record_t Foo_record;
9*f4a2713aSLionel Sambucstruct QuxSize {};
10*f4a2713aSLionel Sambuctypedef struct QuxSize QuxSize;
11*f4a2713aSLionel Sambuctypedef struct {
12*f4a2713aSLionel Sambuc  Foo_record_t Foo;
13*f4a2713aSLionel Sambuc  QuxSize size[0];
14*f4a2713aSLionel Sambuc} __Request__SetPortalSize_t;
15*f4a2713aSLionel Sambuc
16*f4a2713aSLionel Sambucdouble __Foo_READSWAP__double(double*);
17*f4a2713aSLionel Sambuc
18*f4a2713aSLionel Sambucstatic __inline__ bar_return_t
19*f4a2713aSLionel Sambuc__Beeble_check__Request__SetPortalSize_t(__Request__SetPortalSize_t *In0P) {
20*f4a2713aSLionel Sambuc  if (In0P->Foo.int_rep != Foo_record.int_rep) {
21*f4a2713aSLionel Sambuc    do {
22*f4a2713aSLionel Sambuc      int __i__, __C__ = (2);
23*f4a2713aSLionel Sambuc      for (__i__ = 0;
24*f4a2713aSLionel Sambuc           __i__ < __C__;
25*f4a2713aSLionel Sambuc           __i__++) do {
26*f4a2713aSLionel Sambuc        *(&((double *)(&In0P->size))[__i__]) =
27*f4a2713aSLionel Sambuc          __Foo_READSWAP__double(&((double *)(&In0P->size))[__i__]);
28*f4a2713aSLionel Sambuc      }
29*f4a2713aSLionel Sambuc      while (0);
30*f4a2713aSLionel Sambuc    }
31*f4a2713aSLionel Sambuc    while (0);
32*f4a2713aSLionel Sambuc  }
33*f4a2713aSLionel Sambuc  return 0;
34*f4a2713aSLionel Sambuc}
35