re PR target/35907 (64-bit power6 glibc miscompilation)

PR target/35907
	* gcc.target/powerpc/pr35907.c: New test.

Co-Authored-By: Peter Bergner <bergner@vnet.ibm.com>

From-SVN: r134447
This commit is contained in:
Jakub Jelinek 2008-04-18 21:11:57 +02:00 committed by Jakub Jelinek
parent 3569056b39
commit 56cb2545ae
2 changed files with 65 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2008-04-18 Jakub Jelinek <jakub@redhat.com>
Peter Bergner <bergner@vnet.ibm.com>
PR target/35907
* gcc.target/powerpc/pr35907.c: New test.
2008-04-18 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/dynamic_elab_pkg.ads: New helper.

View File

@ -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;
}