summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ubsan/null-3.C
blob: 0dfb879990b1853471208eace88bf551b02db2fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// { dg-do run }
// { dg-options "-fsanitize=null" }

int
main (void)
{
  int *p = 0;

  int &r1 = *p;
  int &r2 = *p;
  int &r3 = *p;
  int &r4 = *p;
  int &r5 = *p;
}

// { dg-output "reference binding to null pointer of type 'int'(\n|\r\n|\r)" }
// { dg-output "\[^\n\r]*reference binding to null pointer of type 'int'(\n|\r\n|\r)" }
// { dg-output "\[^\n\r]*reference binding to null pointer of type 'int'(\n|\r\n|\r)" }
// { dg-output "\[^\n\r]*reference binding to null pointer of type 'int'(\n|\r\n|\r)" }
// { dg-output "\[^\n\r]*reference binding to null pointer of type 'int'" }