From: Jakub Jelinek Date: Fri, 18 Apr 2008 19:11:57 +0000 (+0200) Subject: re PR target/35907 (64-bit power6 glibc miscompilation) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=56cb2545ae95cf6eb72fe49fc914fe7416dd1b8f;p=gcc.git re PR target/35907 (64-bit power6 glibc miscompilation) PR target/35907 * gcc.target/powerpc/pr35907.c: New test. Co-Authored-By: Peter Bergner From-SVN: r134447 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3ef066ad9e4..86036d71499 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-04-18 Jakub Jelinek + Peter Bergner + + PR target/35907 + * gcc.target/powerpc/pr35907.c: New test. + 2008-04-18 Eric Botcazou * gnat.dg/dynamic_elab_pkg.ads: New helper. diff --git a/gcc/testsuite/gcc.target/powerpc/pr35907.c b/gcc/testsuite/gcc.target/powerpc/pr35907.c new file mode 100644 index 00000000000..e1749dea8c9 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr35907.c @@ -0,0 +1,59 @@ +/* PR target/35907 */ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-O2 -maltivec" } */ + +#include "altivec_check.h" + +#define vector __attribute__((vector_size (16))) +union +{ + vector int k; + int c[16]; +} u, v, w; +vector int m; + +void __attribute__((noinline)) +bar (void *i, vector int j) +{ + asm volatile ("" : : "r" (i), "r" (&j) : "memory"); +} + +int __attribute__((noinline)) +foo (int i, vector int j) +{ + char *p = __builtin_alloca (64 + i); + m += u.k; + v.k = m; + w.k = j; + if (__builtin_memcmp (&v.c, &w.c, 16) != 0) + __builtin_abort (); + j += u.k; + bar (p, j); + j += u.k; + bar (p, j); + return 0; +} + +void +test (void) +{ + vector int l; + int i; + for (i = 0; i < 4; i++) + u.c[i] = i; + l = u.k; + if (foo (64, l)) + __builtin_abort (); + l += u.k; + if (foo (64, l)) + __builtin_abort (); +} + +int +main () +{ + altivec_check (); + test (); + return 0; +}