Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.dg / autopar / pr49960-1.c
blobbd65c22c3091d0fbd21654ad0bb158c68bcae8b6
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops2-details -fdump-tree-optimized" } */
4 #include <stdlib.h>
5 #include <stdio.h>
7 int main()
9 unsigned int x, y, idx, H = 1024, W = 1024;
11 int * tmps = (int *)malloc(H*W*sizeof(int));
13 /* This loop gets parallelized even though output dependences exist
14 between writes to 'tmps' that prevent parallelization.
15 For example: tmps[1] = 1, ..., tmps[1] = 17. */
17 for(x = 1; x < H; x++)
19 for(y = 1; y < W; y++)
21 idx = x*W+y;
22 tmps[idx % 4096] = idx;
26 for(x = 1; x < 8; x++)
27 printf("tmps[%d]=%d\n", x, tmps[x]);
29 return 0;
31 /* Check that no loop gets parallelized. */
33 /* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 0 "parloops2" } } */
34 /* { dg-final { scan-tree-dump-times "loopfn" 0 "optimized" } } */