From fad392cb78d33c6306c71116119c5c1716409390 Mon Sep 17 00:00:00 2001 From: hubicka Date: Fri, 7 Jan 2011 23:29:27 +0000 Subject: [PATCH] Get builtins tests ready for linker plugin. * gcc.c-torture/execute/builtins/memcpy-chk.c (s2,s3,l1): Mark volatile. * gcc.c-torture/execute/builtins/memops-asm-lib.c (my_memcpy, my_bcopy, my_memset, my_bzero): Mark used. * gcc.c-torture/execute/builtins/memset-chk.c (l1, l3): Mark volatile. * gcc.c-torture/execute/builtins/memmove-chk.c (s1,s2,s3,l1): Mark volatile. * gcc.c-torture/execute/builtins/mempcpy-chk.c (s2,s3,l1): Mark volatile git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168588 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 10 ++++++++++ gcc/testsuite/gcc.c-torture/execute/builtins/memcpy-chk.c | 6 +++--- gcc/testsuite/gcc.c-torture/execute/builtins/memmove-chk.c | 8 ++++---- .../gcc.c-torture/execute/builtins/memops-asm-lib.c | 12 ++++++++++++ gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-chk.c | 6 +++--- gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk.c | 4 ++-- 6 files changed, 34 insertions(+), 12 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e91432e..def9433 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,15 @@ 2011-01-07 Jan Hubicka + Get builtins tests ready for linker plugin. + * gcc.c-torture/execute/builtins/memcpy-chk.c (s2,s3,l1): Mark volatile. + * gcc.c-torture/execute/builtins/memops-asm-lib.c (my_memcpy, my_bcopy, my_memset, + my_bzero): Mark used. + * gcc.c-torture/execute/builtins/memset-chk.c (l1, l3): Mark volatile. + * gcc.c-torture/execute/builtins/memmove-chk.c (s1,s2,s3,l1): Mark volatile. + * gcc.c-torture/execute/builtins/mempcpy-chk.c (s2,s3,l1): Mark volatile + +2011-01-07 Jan Hubicka + PR tree-optimization/46367 * g++.dg/torture/pr46367.C: New file. diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memcpy-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memcpy-chk.c index 28f7ae7..5b245e5 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/memcpy-chk.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memcpy-chk.c @@ -12,9 +12,9 @@ extern int memcmp (const void *, const void *, size_t); const char s1[] = "123"; char p[32] = ""; -char *s2 = "defg"; -char *s3 = "FGH"; -size_t l1 = 1; +volatile char *s2 = "defg"; /* prevent constant propagation to happen when whole program assumptions are made. */ +volatile char *s3 = "FGH"; /* prevent constant propagation to happen when whole program assumptions are made. */ +volatile size_t l1 = 1; /* prevent constant propagation to happen when whole program assumptions are made. */ void __attribute__((noinline)) diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-chk.c index 1227227..73b3588 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-chk.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memmove-chk.c @@ -11,11 +11,11 @@ extern int memcmp (const void *, const void *, size_t); #include "chk.h" -const char s1[] = "123"; +const char s1[] = "123"; char p[32] = ""; -char *s2 = "defg"; -char *s3 = "FGH"; -size_t l1 = 1; +volatile char *s2 = "defg"; /* prevent constant propagation to happen when whole program assumptions are made. */ +volatile char *s3 = "FGH"; /* prevent constant propagation to happen when whole program assumptions are made. */ +volatile size_t l1 = 1; /* prevent constant propagation to happen when whole program assumptions are made. */ void __attribute__((noinline)) diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c index eeffe5c..0000529 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c @@ -4,6 +4,9 @@ typedef __SIZE_TYPE__ size_t; #define TEST_ABORT if (inside_main) abort() +/* LTO code is at the present to able to track that asm alias my_bcopy on builtin + actually refers to this function. See PR47181. */ +__attribute__ ((used)) void * my_memcpy (void *d, const void *s, size_t n) { @@ -14,6 +17,9 @@ my_memcpy (void *d, const void *s, size_t n) return (char *) d; } +/* LTO code is at the present to able to track that asm alias my_bcopy on builtin + actually refers to this function. See PR47181. */ +__attribute__ ((used)) void my_bcopy (const void *s, void *d, size_t n) { @@ -31,6 +37,9 @@ my_bcopy (const void *s, void *d, size_t n) } } +/* LTO code is at the present to able to track that asm alias my_bcopy on builtin + actually refers to this function. See PR47181. */ +__attribute__ ((used)) void * my_memset (void *d, int c, size_t n) { @@ -40,6 +49,9 @@ my_memset (void *d, int c, size_t n) return (char *) d; } +/* LTO code is at the present to able to track that asm alias my_bcopy on builtin + actually refers to this function. See PR47181. */ +__attribute__ ((used)) void my_bzero (void *d, size_t n) { diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-chk.c index a59d59b..7a1737c 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-chk.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-chk.c @@ -13,9 +13,9 @@ extern int memcmp (const void *, const void *, size_t); const char s1[] = "123"; char p[32] = ""; -char *s2 = "defg"; -char *s3 = "FGH"; -size_t l1 = 1; +volatile char *s2 = "defg"; /* prevent constant propagation to happen when whole program assumptions are made. */ +volatile char *s3 = "FGH"; /* prevent constant propagation to happen when whole program assumptions are made. */ +volatile size_t l1 = 1; /* prevent constant propagation to happen when whole program assumptions are made. */ void __attribute__((noinline)) diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk.c index a8f09a7..902a885 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memset-chk.c @@ -13,8 +13,8 @@ extern int memcmp (const void *, const void *, size_t); char buffer[32]; int argc = 1; -size_t l1 = 1; -char *s3 = "FGH"; +volatile size_t l1 = 1; /* prevent constant propagation to happen when whole program assumptions are made. */ +volatile char *s3 = "FGH"; /* prevent constant propagation to happen when whole program assumptions are made. */ char *s4; void -- 2.7.4