Add _FloatN, _FloatNx tests for __builtin_fpclassify.
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / transpose-5.c
blob8ed39534598a512b74d3793d4e2170f69c7d6063
1 /* { dg-do run } */
2 /* { dg-options "-fwhole-program" } */
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <math.h>
7 #include <string.h>
9 void mem_init (void);
10 int ARCHnodes, ARCHnodes1;
11 int ***vel;
13 /* The whole matrix VEL is flattened (3 dimensions).
14 The dimensions are NOT transposed. */
15 /*--------------------------------------------------------------------------*/
17 int
18 main (int argc, char **argv)
20 int i, j, k;
22 ARCHnodes = 2;
23 ARCHnodes1 = 4;
25 /* Dynamic memory allocations and initializations */
27 mem_init ();
29 for (j = 0; j < 3; j++)
31 for (i = 0; i < 2; i++)
33 for (k = 0; k < 4; k++)
35 printf ("[%d][%d][%d]=%d ", i, j, k, vel[i][j][k]);
37 printf ("\n");
39 printf ("\n");
41 for (i = 0; i < 2; i++)
42 for (j = 0; j < 3; j++)
43 free (vel[i][j]);
45 for (i = 0; i < 2; i++)
46 free (vel[i]);
48 free (vel);
49 return 0;
52 /*--------------------------------------------------------------------------*/
53 /* Dynamic memory allocations and initializations */
55 void
56 mem_init (void)
59 signed int i, j, k,d;
61 d = 0;
62 vel = (int ***) malloc (ARCHnodes * sizeof (int **));
64 for (i = 0; i < ARCHnodes; i++)
66 vel[i] = (int **) malloc (3 * sizeof (int *));
67 if (vel[i] == (int **) NULL)
69 printf ("malloc failed for vel[%d]\n", i);
70 exit (0);
73 for (i = 0; i < ARCHnodes; i++)
75 for (j = 0; j < 3; j++)
77 vel[i][j] = (int *) malloc (ARCHnodes1 * sizeof (int));
80 for (i = 0; i < ARCHnodes; i++)
82 for (j = 0; j < 3; j++)
84 for (k = 0; k < ARCHnodes1; k++)
86 printf ("acc to dim2 ");
87 vel[i][j][k] = d;
88 d++;
92 printf ("\n");
95 /*--------------------------------------------------------------------------*/