gcc/testsuite/gcc.dg/pr79972.c
raw| 1 | /* PR tree-optimization/79972 */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-Walloca -Wvla-larger-than=10000" } */ |
| 4 | |
| 5 | int |
| 6 | f (int dim, int *b, int *c) |
| 7 | { |
| 8 | /* -Wvla-larger-than is only issued with optimization (see PR 100510). */ |
| 9 | int newcentroid[3][dim]; |
| 10 | int *a = newcentroid[2]; |
| 11 | int i, dist = 0; |
| 12 | __builtin_memcpy (newcentroid, c, sizeof (newcentroid)); |
| 13 | for (i = 0; i < dim; i++) |
| 14 | dist += (a[i] - b[i]) * (a[i] - b[i]); |
| 15 | return dist; |
| 16 | } |