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