2017-03-04 02:02:02 +08:00
|
|
|
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin9 -analyzer-checker=core,alpha.core -analyzer-store=region -verify -fblocks %s
|
2012-10-19 20:44:48 +08:00
|
|
|
// expected-no-diagnostics
|
2009-07-15 07:17:22 +08:00
|
|
|
|
2009-07-15 10:31:43 +08:00
|
|
|
// Here is a case where a pointer is treated as integer, invalidated as an
|
|
|
|
// integer, and then used again as a pointer. This test just makes sure
|
|
|
|
// we don't crash.
|
|
|
|
typedef unsigned uintptr_t;
|
|
|
|
void test_pointer_invalidated_as_int_aux(uintptr_t* ptr);
|
2022-02-13 21:02:46 +08:00
|
|
|
void test_pointer_invalidated_as_int(void) {
|
2009-07-15 10:31:43 +08:00
|
|
|
void *x;
|
|
|
|
test_pointer_invalidated_as_int_aux((uintptr_t*) &x);
|
|
|
|
// Here we have a pointer to integer cast.
|
|
|
|
uintptr_t y = (uintptr_t) x;
|
2009-07-15 07:17:22 +08:00
|
|
|
}
|
|
|
|
|