diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-26 20:03:21 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-26 20:03:21 +0000 |
commit | c79b54af83c8031caac515081fb7c56a127b90e3 (patch) | |
tree | e5391ba973e0b1e273c9037981ed8ac55099e03f /gcc/testsuite/gcc.c-torture | |
parent | 8dfbafc807ba917d346d622915073bd4450ad344 (diff) | |
download | gcc-c79b54af83c8031caac515081fb7c56a127b90e3.tar.gz |
2010-10-26 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 165980
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@165983 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
9 files changed, 236 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/20070522-1.c b/gcc/testsuite/gcc.c-torture/compile/20070522-1.c index 4c8b70c80d7..1e1e8020d32 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20070522-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20070522-1.c @@ -1,3 +1,5 @@ +/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + /* This was PR 31606, we were trying to use TImode to expand the struct copy in SRA but TImode is not support on ia32. */ diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33617.c b/gcc/testsuite/gcc.c-torture/compile/pr33617.c index 0174fb60485..51c6f14431e 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr33617.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr33617.c @@ -1,3 +1,5 @@ +/* { dg-options "-w -Wno-psabi" { target { i?86-*-* x86_64-*-* } } } */ + typedef float V8SF __attribute__ ((vector_size (32))); void bar (V8SF); void diff --git a/gcc/testsuite/gcc.c-torture/execute/20101011-1.c b/gcc/testsuite/gcc.c-torture/execute/20101011-1.c new file mode 100644 index 00000000000..4c36ad3e5cf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20101011-1.c @@ -0,0 +1,45 @@ +/* With -fnon-call-exceptions 0 / 0 should not be eliminated. The .x + file sets the option. */ + +#ifdef SIGNAL_SUPPRESS +# define DO_TEST 0 +#elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) || defined (__POWERPC__) || defined (__ppc) + /* On PPC division by zero does not trap. */ +# define DO_TEST 0 +#elif defined (__SPU__) + /* On SPU division by zero does not trap. */ +# define DO_TEST 0 +#else +# define DO_TEST 1 +#endif + +#if DO_TEST + +#include <signal.h> + +void +sigfpe (int signum __attribute__ ((unused))) +{ + exit (0); +} + +#endif + +/* When optimizing, the compiler is smart enough to constant fold the + static unset variables i and j to produce 0 / 0, but it can't + eliminate the assignment to the global k. */ +static int i; +static int j; +int k; + +int +main () +{ +#ifdef DO_TEST + signal (SIGFPE, sigfpe); + k = i / j; + abort (); +#else + exit (0); +#endif +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20101011-1.x b/gcc/testsuite/gcc.c-torture/execute/20101011-1.x new file mode 100644 index 00000000000..b5c080dd371 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20101011-1.x @@ -0,0 +1,2 @@ +set additional_flags "-fnon-call-exceptions" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20101025-1.c b/gcc/testsuite/gcc.c-torture/execute/20101025-1.c new file mode 100644 index 00000000000..95361a92487 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20101025-1.c @@ -0,0 +1,30 @@ +static int g_7; +static int *volatile g_6 = &g_7; +int g_3; + +static int f1 (int *p_58) +{ + return *p_58; +} + +void f2 (int i) __attribute__ ((noinline)); +void f2 (int i) +{ + g_3 = i; +} + +int f3 (void) __attribute__ ((noinline)); +int f3 (void) +{ + *g_6 = 1; + f2 (f1 (&g_7)); + return 0; +} + +int main () +{ + f3 (); + if (g_3 != 1) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38151.x b/gcc/testsuite/gcc.c-torture/execute/pr38151.x new file mode 100644 index 00000000000..cb7b119b8cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38151.x @@ -0,0 +1,2 @@ +set additional_flags "-Wno-psabi" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/vector-subscript-1.c b/gcc/testsuite/gcc.c-torture/execute/vector-subscript-1.c new file mode 100644 index 00000000000..03647fd5074 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vector-subscript-1.c @@ -0,0 +1,60 @@ +/* dg-do run */ +#define vector __attribute__((vector_size(sizeof(int)*4) )) + +/* Check to make sure that we extract and insert the vector at the same + location for vector subscripting and that vectors layout are the same + as arrays. */ + +struct TV4 +{ + vector int v; +}; + +typedef struct TV4 MYV4; +static inline int *f(MYV4 *a, int i) +{ + return &(a->v[i]); +} + +static inline MYV4 myfunc2( int x, int y, int z, int w ) +{ + MYV4 temp; + *f(&temp, 0 ) = x; + *f(&temp, 1 ) = y; + *f(&temp, 2 ) = z; + *f(&temp, 3 ) = w; + return temp; +} + +MYV4 val3; + +__attribute__((noinline)) void modify (void) +{ + val3 = myfunc2( 1, 2, 3, 4 ); +} + +int main( int argc, char* argv[] ) +{ + int a[4]; + int i; + + modify(); + + if (*f(&val3, 0 ) != 1) + __builtin_abort (); + if (*f(&val3, 1 ) != 2) + __builtin_abort (); + if (*f(&val3, 2 ) != 3) + __builtin_abort (); + if (*f(&val3, 3 ) != 4) + __builtin_abort (); + + __builtin_memcpy(a, &val3, 16); + for(i = 0; i < 4; i++) + if (a[i] != i+1) + __builtin_abort (); + + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/vector-subscript-2.c b/gcc/testsuite/gcc.c-torture/execute/vector-subscript-2.c new file mode 100644 index 00000000000..d0e5b889c66 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vector-subscript-2.c @@ -0,0 +1,67 @@ +#define vector __attribute__((vector_size(sizeof(int)*4) )) + +/* Check to make sure that we extract and insert the vector at the same + location for vector subscripting (with constant indexes) and + that vectors layout are the same as arrays. */ + +struct TV4 +{ + vector int v; +}; + +typedef struct TV4 MYV4; + +static inline MYV4 myfunc2( int x, int y, int z, int w ) +{ + MYV4 temp; + temp.v[0] = x; + temp.v[1] = y; + temp.v[2] = z; + temp.v[3] = w; + return temp; +} +MYV4 val3; +__attribute__((noinline)) void modify (void) +{ + val3 = myfunc2( 1, 2, 3, 4 ); +} +int main( int argc, char* argv[] ) +{ + int a[4]; + int i; + + /* Set up the vector. */ + modify(); + + /* Check the vector via the global variable. */ + if (val3.v[0] != 1) + __builtin_abort (); + if (val3.v[1] != 2) + __builtin_abort (); + if (val3.v[2] != 3) + __builtin_abort (); + if (val3.v[3] != 4) + __builtin_abort (); + + vector int a1 = val3.v; + + /* Check the vector via a local variable. */ + if (a1[0] != 1) + __builtin_abort (); + if (a1[1] != 2) + __builtin_abort (); + if (a1[2] != 3) + __builtin_abort (); + if (a1[3] != 4) + __builtin_abort (); + + __builtin_memcpy(a, &val3, sizeof(a)); + /* Check the vector via copying it to an array. */ + for(i = 0; i < 4; i++) + if (a[i] != i+1) + __builtin_abort (); + + + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/vector-subscript-3.c b/gcc/testsuite/gcc.c-torture/execute/vector-subscript-3.c new file mode 100644 index 00000000000..97d531c1733 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vector-subscript-3.c @@ -0,0 +1,26 @@ +/* dg-do run */ +#define vector __attribute__((vector_size(16) )) + +/* Check whether register declaration of vector type still + allow us to subscript this type. */ + +typedef vector short myvec_t; + +struct vec_s { + vector short member; +}; + + +int main () { + register short vector v0 = {1,2,3,4,5,6,7}; + register myvec_t v1 = {1,2,3,4,5,6,7}; + register struct vec_s v2; + + v2.member = v1; + + short r = v0[0] + v1[1] + v2.member[2]; + if (r != 6) + __builtin_abort (); + + return 0; +} |