diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-3.c')
-rw-r--r-- | gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-3.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-3.c new file mode 100644 index 000000000..f58562c63 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-3.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-options "-fsanitize=null -w" } */ +/* { dg-shouldfail "ubsan" } */ + +int +foo (int *p) +{ + return *p; +} + +int +main (void) +{ + int **p = 0; + return foo (*p); +} + +/* { dg-output "load of null pointer of type 'int \\*'(\n|\r\n|\r)" } */ |