2017-12-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / graphite / run-id-5.c
blob9005c43fd4734897b2fc9a4807ab33c60bf1516d
1 /* { dg-options "-O2 -ftree-vectorize -fno-vect-cost-model -fno-tree-scev-cprop -fgraphite-identity" } */
2 /* { dg-require-effective-target vect_int } */
4 /* gcc.dg/vect/no-scevccp-outer-22.c was miscompiled by Graphite.
5 Adding it here to always test it with Graphite. */
7 #include <stdarg.h>
9 extern void abort ();
10 #define N 40
12 int a[N];
14 __attribute__ ((noinline)) int
15 foo (int n){
16 int i,j;
17 int sum;
19 if (n<=0)
20 return 0;
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;
28 a[i] = sum + j;
32 int main (void)
34 int i,j;
35 int sum;
37 for (i=0; i<N; i++)
38 a[i] = i;
40 foo (N);
42 /* check results: */
43 for (i=0; i<N; i++)
45 sum = 0;
46 for (j = 0; j < N; j+=2)
47 sum += j;
48 if (a[i] != sum + j)
49 abort();
52 return 0;