No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gcc4 / gcc / testsuite / gcc.dg / vmx / gcc-bug-i.c
blob58ccb3fe763d2dcd2be85354425251581fd1f695
1 #include "harness.h"
3 /* This problem occurs if a function is inlined. When its local
4 variables get allocated space on the caller's (the function to
5 which it is inlined) stack frame, they don't get 16-byte alignment
6 even if they need it. Here's an example with a union (that's the
7 first case I uncovered, but it's probably a general occurrence on
8 inlining). */
10 #define N 10
11 /* adjust N = size of buffer to try to get bad alignment for inlined union */
13 #define DO_INLINE __attribute__ ((always_inline))
14 #define DONT_INLINE __attribute__ ((noinline))
16 static DO_INLINE int inline_me(vector signed short data)
18 union {vector signed short v; signed short s[8];} u;
19 u.v = data;
20 return u.s[7];
23 static DONT_INLINE int foo(vector signed short data)
25 int c, buffer[N], i;
26 c = inline_me(data);
27 for (i=0; i<N; i++) {
28 if (i == 0)
29 buffer[i] = c;
30 else
31 buffer[i] = buffer[i-1] + c*i;
33 return buffer[N-1];
36 static void test()
38 check(foo((vector signed short)
39 ((vector unsigned char){1,2,3,4,5,6,7,8,
40 9,10,11,12,13,14,15,16})) == 0x2b4e0,
41 "foo");