gcc/testsuite/g++.dg/ubsan/null-4.C
raw| 1 | // { dg-do run } |
| 2 | // { dg-options "-O -fsanitize=null -fno-sanitize-recover=null -fdump-tree-sanopt-details" } |
| 3 | // { dg-skip-if "" { *-*-* } { "-flto -fno-fat-lto-objects" } } |
| 4 | // { dg-shouldfail "ubsan" } |
| 5 | |
| 6 | int |
| 7 | main (void) |
| 8 | { |
| 9 | int *p = 0; |
| 10 | |
| 11 | int &r1 = *p; |
| 12 | int &r2 = *p; |
| 13 | int &r3 = *p; |
| 14 | int &r4 = *p; |
| 15 | int &r5 = *p; |
| 16 | } |
| 17 | |
| 18 | // { dg-output "reference binding to null pointer of type 'int'" } |
| 19 | // { dg-final { scan-tree-dump-times "Optimizing" 4 "sanopt"} } |