xref: /minix3/external/bsd/llvm/dist/clang/test/Analysis/misc-ps-region-store-i386.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,alpha.core -analyzer-store=region -verify -fblocks %s
2*f4a2713aSLionel Sambuc// expected-no-diagnostics
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuc// Here is a case where a pointer is treated as integer, invalidated as an
5*f4a2713aSLionel Sambuc// integer, and then used again as a pointer.   This test just makes sure
6*f4a2713aSLionel Sambuc// we don't crash.
7*f4a2713aSLionel Sambuctypedef unsigned uintptr_t;
8*f4a2713aSLionel Sambucvoid test_pointer_invalidated_as_int_aux(uintptr_t* ptr);
9*f4a2713aSLionel Sambucvoid test_pointer_invalidated_as_int() {
10*f4a2713aSLionel Sambuc  void *x;
11*f4a2713aSLionel Sambuc  test_pointer_invalidated_as_int_aux((uintptr_t*) &x);
12*f4a2713aSLionel Sambuc  // Here we have a pointer to integer cast.
13*f4a2713aSLionel Sambuc  uintptr_t y = (uintptr_t) x;
14*f4a2713aSLionel Sambuc}
15*f4a2713aSLionel Sambuc
16