summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/pr52457.c
blob: 4470e55023fe1210ac67c96d2b89a432932de9bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* { dg-do run { target { powerpc*-*-linux* } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O1 -mcpu=power7" } */

extern void abort (void);

typedef long long T;
typedef T vl_t __attribute__((vector_size(2 * sizeof (T))));

vl_t
buggy_func (T x)
{
  vl_t w;
  T *p = (T *)&w;
  p[0] = p[1] = x;
  return w;
}

int
main(void)
{
  vl_t rval;
  T *pl;

  pl = (T *) &rval;
  rval = buggy_func (2);

  if (pl[0] != 2 || pl[1] != 2)
    abort ();

  return 0;
}