(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
graphite/
run-id-5.c
       1  /* { dg-options "-O2 -ftree-vectorize -fno-vect-cost-model -fno-tree-scev-cprop -fgraphite-identity" } */
       2  /* { dg-require-effective-target vect_int } */
       3  
       4  /* gcc.dg/vect/no-scevccp-outer-22.c was miscompiled by Graphite.
       5     Adding it here to always test it with Graphite.  */
       6  
       7  #include <stdarg.h>
       8  
       9  extern void abort ();
      10  #define N 40
      11  
      12  int a[N];
      13  
      14  __attribute__ ((noinline)) int
      15  foo (int n){
      16    int i,j;
      17    int sum;
      18  
      19    if (n<=0)
      20      return 0;
      21  
      22    /* inner-loop index j used after the inner-loop */
      23    for (i = 0; i < N; i++) {
      24      sum = 0;
      25      for (j = 0; j < n; j+=2) {
      26        sum += j;
      27      }
      28      a[i] = sum + j;
      29    }
      30  }
      31  
      32  int main (void)
      33  {
      34    int i,j;
      35    int sum;
      36  
      37    for (i=0; i<N; i++)
      38      a[i] = i;
      39  
      40    foo (N);
      41  
      42    /* check results:  */
      43    for (i=0; i<N; i++)
      44      {
      45        sum = 0;
      46        for (j = 0; j < N; j+=2)
      47          sum += j;
      48        if (a[i] != sum + j)
      49          abort();
      50      }
      51  
      52    return 0;
      53  }
      54