diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a8236a5ecbf35b431dc12dc0e0a606393b8e5e09..385068d851275b3843f81444c75f3bf6a05e6b20 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2005-09-09 David Daney <ddaney@avtrex.com> + + * gcc.c-torture/execute/20010124-1.c: Removed and split into two new + files which are ... + * gcc.c-torture/execute/builtins/20010124-1: ... here and ... + * gcc.c-torture/execute/builtins/20010124-1-lib.c: ... here. + 2005-09-09 Francois-Xavier Coudert <coudert@clipper.ens.fr> * gfortran.dg/iostat_2.f90: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/20010124-1.c b/gcc/testsuite/gcc.c-torture/execute/20010124-1.c deleted file mode 100644 index 5db512b6f3e49d0d04d603c3613a774f74ddc350..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.c-torture/execute/20010124-1.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Verify that structure return doesn't invoke memcpy on - overlapping objects. */ - -extern void abort (void); -typedef __SIZE_TYPE__ size_t; - -struct S { - char stuff[1024]; -}; - -union U { - struct { - int space; - struct S s; - } a; - struct { - struct S s; - int space; - } b; -}; - -static struct S f(struct S *); -static void g(union U *); - -int main() -{ - union U u; - u.b.s = f(&u.a.s); - u.a.s = f(&u.b.s); - g(&u); - return 0; -} - -static struct S f(struct S *p) -{ - return *p; -} - -static void g(union U *p) -{ -} - -static void *memcpy(void *a, const void *b, size_t len) -{ - if (a < b && a+len > b) - abort (); - if (b < a && b+len > a) - abort (); - return a; -} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1-lib.c new file mode 100644 index 0000000000000000000000000000000000000000..5f6a7487fd8fb140d409f063ba224a326d2c630e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1-lib.c @@ -0,0 +1,50 @@ +/* Verify that structure return doesn't invoke memcpy on + overlapping objects. */ + +extern void abort (void); +extern int inside_main; +typedef __SIZE_TYPE__ size_t; + +struct S { + char stuff[1024]; +}; + +union U { + struct { + int space; + struct S s; + } a; + struct { + struct S s; + int space; + } b; +}; + +struct S f(struct S *p) +{ + return *p; +} + +void g(union U *p) +{ +} + +void *memcpy(void *a, const void *b, size_t len) +{ + if (inside_main) + { + if (a < b && a+len > b) + abort (); + if (b < a && b+len > a) + abort (); + return a; + } + else + { + char *dst = (char *) a; + const char *src = (const char *) b; + while (len--) + *dst++ = *src++; + return a; + } +} diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1.c b/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1.c new file mode 100644 index 0000000000000000000000000000000000000000..816287344e4dedb0660048c61a117ac78e5d1a4a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1.c @@ -0,0 +1,30 @@ +/* Verify that structure return doesn't invoke memcpy on + overlapping objects. */ + +extern void abort (void); + +struct S { + char stuff[1024]; +}; + +union U { + struct { + int space; + struct S s; + } a; + struct { + struct S s; + int space; + } b; +}; + +struct S f(struct S *); +void g(union U *); + +void main_test(void) +{ + union U u; + u.b.s = f(&u.a.s); + u.a.s = f(&u.b.s); + g(&u); +}