http://llvm.org/bugs/show_bug.cgi?id=7297

           Summary: Member access is not the same for b[0].x and b->x
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


If I have a pointer (p) to a struct on the stack (a), setting a field using
p->x or a.x does not affect p[0].x, or vice versa. The test case below says
p[0].x is a garbage value.

Reminiscent of and possibly related to PR7218.

---

#define FAIL ((void)*(char*)0)
struct simple { int x; };

void test () {
  struct simple a;
  struct simple *p = &a;
  p->x = 5;
  if (!p[0].x) FAIL; // no-warning
  if (p[0].x) FAIL; // expected-warning {{null}}
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to