(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
pr48172.c
       1  #include "tree-vect.h"
       2  
       3  extern void *memset(void *s, int c, __SIZE_TYPE__ n);
       4  extern void abort (void);
       5  
       6  #define ASIZE 1028
       7  #define HALF (ASIZE/2)
       8  
       9  int main() {
      10    unsigned int array[ASIZE];
      11    int i;
      12  
      13    check_vect ();
      14  
      15    memset(array, 0, sizeof(array));
      16  
      17    /* initialize first half of the array */
      18    for (i = 0; i < HALF; i++)
      19      array[i] = i;
      20  
      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];
      26  
      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 ();
      31  
      32    return 0;
      33  }
      34