2018-05-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / graphite / run-id-6.c
blobdafa7f8bec7e12123dd3b09d4a7886b4a95bad80
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-4.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 /* induction variable k advances through inner and outer loops. */
16 __attribute__ ((noinline)) int
17 foo (int n){
18 int i,j,k=0;
19 int sum;
21 if (n<=0)
22 return 0;
24 for (i = 0; i < N; i++) {
25 sum = 0;
26 for (j = 0; j < n; j+=2) {
27 sum += k++;
29 a[i] = sum + j;
33 int main (void)
35 int i,j,k=0;
36 int sum;
38 for (i=0; i<N; i++)
39 a[i] = i;
41 foo (N);
43 /* check results: */
44 for (i=0; i<N; i++)
46 sum = 0;
47 for (j = 0; j < N; j+=2)
48 sum += k++;
49 if (a[i] != sum + j)
50 abort();
53 return 0;