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