Debian Codegraph @

gcc/testsuite/gdc.dg/ubsan/attr_no_sanitize2.d

raw
1 // { dg-options "-fsanitize=undefined -O3 -fdump-tree-optimized" }
2 // { dg-do compile }
3
4 import gcc.attributes;
5
6 @no_sanitize("invalid_name")
7 void func1() { } // { dg-warning "attribute directive ignored" }
8
9 @no_sanitize("address")
10 @no_sanitize("thread")
11 @no_sanitize("address,thread")
12 @no_sanitize("address", "undefined")
13 @no_sanitize("undefined", "leak", "return,null,bounds")
14 void func2() { }
15
16 pragma(inline, true)
17 @no_sanitize("undefined")
18 void test_no_undefined()()
19 {
20 counter++;
21 }
22
23 pragma(inline, true)
24 void test_sanitize()()
25 {
26 counter++;
27 }
28
29 void func3()
30 {
31 counter++;
32 test_no_undefined();
33 test_sanitize();
34 }
35
36 private __gshared int counter;
37
38 // { dg-final { scan-tree-dump-times "Function test_no_undefined" 1 "optimized" } }
39 // { dg-final { scan-tree-dump-times "Function test_sanitize" 0 "optimized" } }