gcc/testsuite/g++.dg/ubsan/attrib-1.C
raw| 1 | // { dg-do compile } |
| 2 | // { dg-options "-fsanitize=undefined -Wall -Wno-unused-variable -std=c++11" } |
| 3 | |
| 4 | typedef const long int L; |
| 5 | |
| 6 | __attribute__((no_sanitize_undefined)) void |
| 7 | foo (int *p, L *l) |
| 8 | { |
| 9 | int &r = *p; |
| 10 | auto &r2 = *p; |
| 11 | L &lr = *l; |
| 12 | auto &&r3 = *p; |
| 13 | } |
| 14 | |
| 15 | struct U |
| 16 | { |
| 17 | int a; |
| 18 | void foo () {} |
| 19 | }; |
| 20 | |
| 21 | __attribute__((no_sanitize_undefined)) void |
| 22 | bar (U *p) |
| 23 | { |
| 24 | p->foo (); |
| 25 | } |
| 26 | |
| 27 | // { dg-final { scan-assembler-not "__ubsan_handle" } } |