comparison clang/test/Analysis/misc-ps-region-store-x86_64.m @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 1d019706d866
children
comparison
equal deleted inserted replaced
232:70dce7da266c 236:c4bab56944e8
1 // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin9 -analyzer-checker=core,alpha.core -analyzer-store=region -verify -fblocks %s 1 // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin9 -analyzer-checker=core,alpha.core -verify -fblocks %s
2 // expected-no-diagnostics 2 // expected-no-diagnostics
3 3
4 // Here is a case where a pointer is treated as integer, invalidated as an 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 5 // integer, and then used again as a pointer. This test just makes sure
6 // we don't crash. 6 // we don't crash.
7 typedef unsigned long uintptr_t; 7 typedef unsigned long uintptr_t;
8 void test_pointer_invalidated_as_int_aux(uintptr_t* ptr); 8 void test_pointer_invalidated_as_int_aux(uintptr_t* ptr);
9 void test_pointer_invalidated_as_int() { 9 void test_pointer_invalidated_as_int(void) {
10 void *x; 10 void *x;
11 test_pointer_invalidated_as_int_aux((uintptr_t*) &x); 11 test_pointer_invalidated_as_int_aux((uintptr_t*) &x);
12 // Here we have a pointer to integer cast. 12 // Here we have a pointer to integer cast.
13 uintptr_t y = (uintptr_t) x; 13 uintptr_t y = (uintptr_t) x;
14 } 14 }