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
This commit is contained in:
Jakub Jelinek 2017-11-27 11:29:03 +01:00 committed by Jakub Jelinek
parent b8cb3096f7
commit 8cb715989f
2 changed files with 12 additions and 2 deletions

View File

@ -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.

View File

@ -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