2018-01-16 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr48172.c
bloba7fc05cae9119076efad4ca13a0f6fd0aff004b7
1 #include "tree-vect.h"
3 extern void *memset(void *s, int c, __SIZE_TYPE__ n);
4 extern void abort (void);
6 #define ASIZE 1028
7 #define HALF (ASIZE/2)
9 int main() {
10 unsigned int array[ASIZE];
11 int i;
13 check_vect ();
15 memset(array, 0, sizeof(array));
17 /* initialize first half of the array */
18 for (i = 0; i < HALF; i++)
19 array[i] = i;
21 /* fill second half of array in by summing earlier elements of the array
22 gcc 4.5.1 and 4.5.2 incorrectly vectorize this loop! aray[1025] is left
23 at 0 for ASIZE=1028 */
24 for (i = 0; i < HALF-1; i++)
25 array[HALF+i] = array[2*i] + array[2*i + 1];
27 /* see if we have any failures */
28 for (i = 0; i < HALF - 1; i++)
29 if (array[HALF+i] != array[2*i] + array[2*i + 1])
30 abort ();
32 return 0;