aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-11-27 11:29:03 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2017-11-27 11:29:03 +0100
commit8cb715989f978104108606d65233838105fd41eb (patch)
tree1c92aff3baff15053201fe0ca9ad39267a4089a9
parentb8cb3096f78581c16d87469706e49b1a4ec345f0 (diff)
downloadgcc-8cb715989f978104108606d65233838105fd41eb.zip
gcc-8cb715989f978104108606d65233838105fd41eb.tar.gz
gcc-8cb715989f978104108606d65233838105fd41eb.tar.bz2
null-8.C (bar): New function.
* g++.dg/ubsan/null-8.C (bar): New function. (foo): Use bar instead of __builtin_printf. From-SVN: r255162
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/ubsan/null-8.C11
2 files changed, 12 insertions, 2 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 87e930a..1c09306 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2017-11-27 Jakub Jelinek <jakub@redhat.com>
+ * g++.dg/ubsan/null-8.C (bar): New function.
+ (foo): Use bar instead of __builtin_printf.
+
PR debug/81307
* g++.dg/debug/debug9.C: Remove -fno-reorder-blocks-and-partition
workaround.
diff --git a/gcc/testsuite/g++.dg/ubsan/null-8.C b/gcc/testsuite/g++.dg/ubsan/null-8.C
index 259a213..cea289e 100644
--- a/gcc/testsuite/g++.dg/ubsan/null-8.C
+++ b/gcc/testsuite/g++.dg/ubsan/null-8.C
@@ -3,13 +3,20 @@
// { dg-options "-fsanitize=null -std=c++14" }
// { dg-output "reference binding to null pointer of type 'const int'" }
+__attribute__((noinline, noclone))
+void
+bar (int x)
+{
+ asm volatile ("" : : "r" (x) : "memory");
+}
+
void
foo (const int &iref)
{
if (&iref)
- __builtin_printf ("iref %d\n", iref);
+ bar (iref);
else
- __builtin_printf ("iref is NULL\n");
+ bar (1);
}
int