gcc/testsuite/g++.dg/ubsan/static-init-2.C
raw| 1 | // PR sanitizer/66190 |
| 2 | // { dg-do run } |
| 3 | // { dg-options "-fsanitize=null -std=c++11" } |
| 4 | |
| 5 | int |
| 6 | main () |
| 7 | { |
| 8 | static int *a; |
| 9 | static int &b = *a; |
| 10 | static int &c (*a); |
| 11 | static int &d {*a}; |
| 12 | return 0; |
| 13 | } |
| 14 | |
| 15 | // { dg-output "reference binding to null pointer of type 'int'(\n|\r\n|\r)" } |
| 16 | // { dg-output "\[^\n\r]*reference binding to null pointer of type 'int'(\n|\r\n|\r)" } |
| 17 | // { dg-output "\[^\n\r]*reference binding to null pointer of type 'int'" } |