aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-9.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-9.c')
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-9.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-9.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-9.c
new file mode 100644
index 000000000..ab43d22a3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/null-9.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=null -w" } */
+/* { dg-shouldfail "ubsan" } */
+
+union U {
+ int i;
+};
+
+int
+main (void)
+{
+ union U *u = 0;
+ return u->i;
+}
+
+/* { dg-output "member access within null pointer of type 'union U'(\n|\r\n|\r)" } */