annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
1 // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin9 -analyzer-checker=core,alpha.core -verify -fblocks %s
150
anatofuz
parents:
diff changeset
2 // expected-no-diagnostics
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 // Here is a case where a pointer is treated as integer, invalidated as an
anatofuz
parents:
diff changeset
5 // integer, and then used again as a pointer. This test just makes sure
anatofuz
parents:
diff changeset
6 // we don't crash.
anatofuz
parents:
diff changeset
7 typedef unsigned long uintptr_t;
anatofuz
parents:
diff changeset
8 void test_pointer_invalidated_as_int_aux(uintptr_t* ptr);
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
9 void test_pointer_invalidated_as_int(void) {
150
anatofuz
parents:
diff changeset
10 void *x;
anatofuz
parents:
diff changeset
11 test_pointer_invalidated_as_int_aux((uintptr_t*) &x);
anatofuz
parents:
diff changeset
12 // Here we have a pointer to integer cast.
anatofuz
parents:
diff changeset
13 uintptr_t y = (uintptr_t) x;
anatofuz
parents:
diff changeset
14 }
anatofuz
parents:
diff changeset
15