Hello!
gcc.target/i386/chkp-strlen-2.c testcase uses stpcpy, which with older
glibc requires _GNU_SOURCE.
The patch also moves some definitions from compile flags to the source.
2016-01-23 Uros Bizjak <[email protected]>
* gcc.target/i386/chkp-strlen-2.c: Define _GNU_SOURCE.
* gcc.target/i386/chkp-strlen-4.c: Move the definition of
_GNU_SOURCE from compile flags to the source.
* gcc.target/i386/chkp-stropt-12.c: Ditto.
* gcc.target/i386/chkp-stropt-16.c: Ditto.
* gcc.target/i386/chkp-stropt-4.c: Ditto.
* gcc.target/i386/chkp-stropt-8.c: Ditto.
Tested on x86_64-linux-gnu and committed to mainline SVN.
Uros.
diff --git a/gcc/testsuite/gcc.target/i386/chkp-strlen-2.c
b/gcc/testsuite/gcc.target/i386/chkp-strlen-2.c
index 9f584ef..470ac47 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-strlen-2.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-strlen-2.c
@@ -3,6 +3,7 @@
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-strlen" } */
/* { dg-final { scan-tree-dump-not "strlen" "strlen" } } */
+#define _GNU_SOURCE
#include "string.h"
char *test (char *str1, char *str2)
diff --git a/gcc/testsuite/gcc.target/i386/chkp-strlen-4.c
b/gcc/testsuite/gcc.target/i386/chkp-strlen-4.c
index 794c8a8..dbf568b 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-strlen-4.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-strlen-4.c
@@ -1,8 +1,9 @@
/* { dg-do compile { target { ! x32 } } } */
/* { dg-require-effective-target mempcpy } */
-/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-strlen
-D_GNU_SOURCE" } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-strlen" } */
/* { dg-final { scan-tree-dump-times "strlen" 1 "strlen" } } */
+#define _GNU_SOURCE
#include "string.h"
char * test (char *str1, char *str2)
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-12.c
b/gcc/testsuite/gcc.target/i386/chkp-stropt-12.c
index 898e776..638810b8 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-12.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-12.c
@@ -1,8 +1,9 @@
/* { dg-do compile { target { ! x32 } } } */
/* { dg-require-effective-target mempcpy } */
-/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt
-fchkp-use-fast-string-functions -D_GNU_SOURCE" } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt
-fchkp-use-fast-string-functions" } */
/* { dg-final { scan-tree-dump-not "mempcpy_nobnd" "chkpopt" } } */
+#define _GNU_SOURCE
#include "string.h"
void test (void *buf1, void *buf2, size_t len)
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-16.c
b/gcc/testsuite/gcc.target/i386/chkp-stropt-16.c
index 891adb4..b0f43a6 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-16.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-16.c
@@ -1,8 +1,9 @@
/* { dg-do compile { target { ! x32 } } } */
/* { dg-require-effective-target mempcpy } */
-/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt
-fchkp-use-nochk-string-functions -fchkp-use-fast-string-functions
-D_GNU_SOURCE" } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt
-fchkp-use-nochk-string-functions -fchkp-use-fast-string-functions" } */
/* { dg-final { scan-tree-dump "mempcpy_nobnd_nochk" "chkpopt" } } */
+#define _GNU_SOURCE
#include "string.h"
void test (int *buf1, int *buf2, size_t len)
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-4.c
b/gcc/testsuite/gcc.target/i386/chkp-stropt-4.c
index 3faa58b..216ed52 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-4.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-4.c
@@ -1,8 +1,9 @@
/* { dg-do compile { target { ! x32 } } } */
/* { dg-require-effective-target mempcpy } */
-/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt
-fchkp-use-nochk-string-functions -D_GNU_SOURCE" } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt
-fchkp-use-nochk-string-functions" } */
/* { dg-final { scan-tree-dump "mempcpy_nochk" "chkpopt" } } */
+#define _GNU_SOURCE
#include "string.h"
void test (int *buf1, int *buf2, size_t len)
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-8.c
b/gcc/testsuite/gcc.target/i386/chkp-stropt-8.c
index 01bff69..afde3c9 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-8.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-8.c
@@ -1,8 +1,9 @@
/* { dg-do compile { target { ! x32 } } } */
/* { dg-require-effective-target mempcpy } */
-/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt
-fchkp-use-fast-string-functions -D_GNU_SOURCE" } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt
-fchkp-use-fast-string-functions" } */
/* { dg-final { scan-tree-dump "mempcpy_nobnd" "chkpopt" } } */
+#define _GNU_SOURCE
#include "string.h"
void test (int *buf1, int *buf2, size_t len)