Small ChangeLog tweak.
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20090113-1.c
blob9c5f01d71fa670bd43e9abb92422e99410bb20c3
1 typedef struct descriptor_dimension
3 int stride;
4 int lbound;
5 int ubound;
6 } descriptor_dimension;
7 typedef struct {
8 int *data;
9 int dtype;
10 descriptor_dimension dim[7];
11 } gfc_array_i4;
13 void
14 msum_i4 (gfc_array_i4 * const retarray,
15 gfc_array_i4 * const array,
16 const int * const pdim)
18 int count[7];
19 int extent[7];
20 int * dest;
21 const int * base;
22 int dim;
23 int n;
24 int len;
26 dim = (*pdim) - 1;
27 len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
29 for (n = 0; n < dim; n++)
31 extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
32 count[n] = 0;
35 dest = retarray->data;
36 base = array->data;
40 int result = 0;
42 for (n = 0; n < len; n++, base++)
43 result += *base;
44 *dest = result;
46 count[0]++;
47 dest += 1;
49 while (count[0] != extent[0]);
52 int main()
54 int rdata[3];
55 int adata[9];
56 gfc_array_i4 retarray = { rdata, 265, { { 1, 1, 3 } } };
57 gfc_array_i4 array = { adata, 266, { { 1, 1, 3 }, { 3, 1, 3 } } };
58 int dim = 2;
59 msum_i4 (&retarray, &array, &dim);
60 return 0;