From: Jakub Jelinek Date: Mon, 27 Nov 2017 10:29:03 +0000 (+0100) Subject: null-8.C (bar): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8cb715989f978104108606d65233838105fd41eb;p=gcc.git 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 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 87e930a3a0a..1c0930619f3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2017-11-27 Jakub Jelinek + * 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 259a213183a..cea289ec261 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