File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
compiler-rt/test/sanitizer_common/TestCases Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Tests -fsanitize-coverage=inline-bool-flag,pc-table
2
+ //
3
+ // REQUIRES: has_sancovcc,stable-runtime
4
+ // UNSUPPORTED: i386-darwin
5
+ //
6
+ // RUN: %clangxx -O0 %s -fsanitize-coverage=inline-bool-flag,pc-table -o %t
7
+ // RUN: %run %t 2>&1 | FileCheck %s
8
+ // XFAIL: tsan
9
+
10
+ #include < assert.h>
11
+ #include < stdint.h>
12
+ #include < stdio.h>
13
+
14
+ const bool *first_flag;
15
+
16
+ extern " C" void __sanitizer_cov_bool_flag_init (const bool *start,
17
+ const bool *end) {
18
+ printf (" INIT: %p %p\n " , start, end);
19
+ assert (end - start > 1 );
20
+ first_flag = start;
21
+ }
22
+
23
+ uintptr_t FirstPC;
24
+ uintptr_t FirstPCFlag;
25
+
26
+ extern " C" void __sanitizer_cov_pcs_init (const uintptr_t *pcs_beg,
27
+ const uintptr_t *pcs_end) {
28
+ const uintptr_t *B = (const uintptr_t *)pcs_beg;
29
+ const uintptr_t *E = (const uintptr_t *)pcs_end;
30
+ assert (B + 1 < E);
31
+ FirstPC = B[0 ];
32
+ FirstPCFlag = B[1 ];
33
+ }
34
+
35
+ int main () {
36
+ assert (first_flag);
37
+ assert (*first_flag);
38
+ assert (FirstPC == (uintptr_t )&main);
39
+ assert (FirstPCFlag == 1 );
40
+ fprintf (stderr, " PASS\n " );
41
+ // CHECK: PASS
42
+ }
You can’t perform that action at this time.
0 commit comments