Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #259 from simgrid/configfix
[simgrid.git] / teshsuite / smpi / mpich3-test / datatype / unusual-noncontigs.c
index 5844207..d783c75 100644 (file)
@@ -10,7 +10,7 @@
 #include <string.h>
 #include "mpi.h"
 
 #include <string.h>
 #include "mpi.h"
 
-/* 
+/*
    The default behavior of the test routines should be to briefly indicate
    the cause of any errors - in this test, that means that verbose needs
    to be set. Verbose should turn on output that is independent of error
    The default behavior of the test routines should be to briefly indicate
    the cause of any errors - in this test, that means that verbose needs
    to be set. Verbose should turn on output that is independent of error
@@ -18,6 +18,7 @@
 */
 static int verbose = 1;
 
 */
 static int verbose = 1;
 
+int main(int argc, char *argv[]);
 int parse_args(int argc, char **argv);
 int struct_negdisp_test(void);
 int vector_negstride_test(void);
 int parse_args(int argc, char **argv);
 int struct_negdisp_test(void);
 int vector_negstride_test(void);
@@ -25,7 +26,8 @@ int indexed_negdisp_test(void);
 int struct_struct_test(void);
 int flatten_test(void);
 
 int struct_struct_test(void);
 int flatten_test(void);
 
-int build_array_section_type(MPI_Aint aext, MPI_Aint astart, MPI_Aint aend, MPI_Datatype *datatype);
+int build_array_section_type(MPI_Aint aext, MPI_Aint astart, MPI_Aint aend,
+                             MPI_Datatype * datatype);
 
 int main(int argc, char *argv[])
 {
 
 int main(int argc, char *argv[])
 {
@@ -36,35 +38,40 @@ int main(int argc, char *argv[])
     parse_args(argc, argv);
 
     /* To improve reporting of problems about operations, we
     parse_args(argc, argv);
 
     /* To improve reporting of problems about operations, we
-       change the error handler to errors return */
-    MPI_Comm_set_errhandler( MPI_COMM_WORLD, MPI_ERRORS_RETURN );
+     * change the error handler to errors return */
+    MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
 
     err = struct_negdisp_test();
 
     err = struct_negdisp_test();
-    if (verbose && err) fprintf(stderr, "error in struct_negdisp_test\n");
+    if (verbose && err)
+        fprintf(stderr, "error in struct_negdisp_test\n");
     errs += err;
 
     err = vector_negstride_test();
     errs += err;
 
     err = vector_negstride_test();
-    if (verbose && err) fprintf(stderr, "error in vector_negstride_test\n");
+    if (verbose && err)
+        fprintf(stderr, "error in vector_negstride_test\n");
     errs += err;
 
     err = indexed_negdisp_test();
     errs += err;
 
     err = indexed_negdisp_test();
-    if (verbose && err) fprintf(stderr, "error in indexed_negdisp_test\n");
+    if (verbose && err)
+        fprintf(stderr, "error in indexed_negdisp_test\n");
     errs += err;
 
     err = struct_struct_test();
     errs += err;
 
     err = struct_struct_test();
-    if (verbose && err) fprintf(stderr, "error in struct_struct_test\n");
+    if (verbose && err)
+        fprintf(stderr, "error in struct_struct_test\n");
     errs += err;
 
     err = flatten_test();
     errs += err;
 
     err = flatten_test();
-    if (verbose && err) fprintf(stderr, "error in flatten_test\n");
+    if (verbose && err)
+        fprintf(stderr, "error in flatten_test\n");
     errs += err;
 
     /* print message and exit */
     if (errs) {
     errs += err;
 
     /* print message and exit */
     if (errs) {
-       fprintf(stderr, "Found %d errors\n", errs);
+        fprintf(stderr, "Found %d errors\n", errs);
     }
     else {
     }
     else {
-       printf(" No Errors\n");
+        printf(" No Errors\n");
     }
     MPI_Finalize();
     return 0;
     }
     MPI_Finalize();
     return 0;
@@ -82,80 +89,80 @@ int struct_negdisp_test(void)
     MPI_Request request;
     MPI_Status status;
 
     MPI_Request request;
     MPI_Status status;
 
-    MPI_Aint disps[2]     = { 0,       -1*((int) sizeof(int)) };
-    int blks[2]           = { 1,       1, };
+    MPI_Aint disps[2] = { 0, -1 * ((int) sizeof(int)) };
+    int blks[2] = { 1, 1, };
     MPI_Datatype types[2] = { MPI_INT, MPI_INT };
 
     err = MPI_Type_struct(2, blks, disps, types, &mystruct);
     if (err != MPI_SUCCESS) {
     MPI_Datatype types[2] = { MPI_INT, MPI_INT };
 
     err = MPI_Type_struct(2, blks, disps, types, &mystruct);
     if (err != MPI_SUCCESS) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "MPI_Type_struct returned error\n");
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "MPI_Type_struct returned error\n");
+        }
     }
 
     MPI_Type_commit(&mystruct);
 
     }
 
     MPI_Type_commit(&mystruct);
 
-    err = MPI_Irecv(recvbuf+1, 4, MPI_INT, 0, 0, MPI_COMM_SELF, &request);
+    err = MPI_Irecv(recvbuf + 1, 4, MPI_INT, 0, 0, MPI_COMM_SELF, &request);
     if (err != MPI_SUCCESS) {
     if (err != MPI_SUCCESS) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "MPI_Irecv returned error\n");
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "MPI_Irecv returned error\n");
+        }
     }
 
     }
 
-    err = MPI_Send(sendbuf+2, 2, mystruct, 0, 0, MPI_COMM_SELF);
+    err = MPI_Send(sendbuf + 2, 2, mystruct, 0, 0, MPI_COMM_SELF);
     if (err != MPI_SUCCESS) {
     if (err != MPI_SUCCESS) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "MPI_Send returned error\n");
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "MPI_Send returned error\n");
+        }
     }
 
     err = MPI_Wait(&request, &status);
     if (err != MPI_SUCCESS) {
     }
 
     err = MPI_Wait(&request, &status);
     if (err != MPI_SUCCESS) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "MPI_Wait returned error\n");
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "MPI_Wait returned error\n");
+        }
     }
 
     /* verify data */
     if (recvbuf[0] != -1) {
     }
 
     /* verify data */
     if (recvbuf[0] != -1) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[0] = %d; should be %d\n", recvbuf[0], -1);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[0] = %d; should be %d\n", recvbuf[0], -1);
+        }
     }
     if (recvbuf[1] != 3) {
     }
     if (recvbuf[1] != 3) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[1] = %d; should be %d\n", recvbuf[1], 3);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[1] = %d; should be %d\n", recvbuf[1], 3);
+        }
     }
     if (recvbuf[2] != 2) {
     }
     if (recvbuf[2] != 2) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[2] = %d; should be %d\n", recvbuf[2], 2);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[2] = %d; should be %d\n", recvbuf[2], 2);
+        }
     }
     if (recvbuf[3] != 5) {
     }
     if (recvbuf[3] != 5) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[3] = %d; should be %d\n", recvbuf[3], 5);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[3] = %d; should be %d\n", recvbuf[3], 5);
+        }
     }
     if (recvbuf[4] != 4) {
     }
     if (recvbuf[4] != 4) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[4] = %d; should be %d\n", recvbuf[4], 4);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[4] = %d; should be %d\n", recvbuf[4], 4);
+        }
     }
     if (recvbuf[5] != -6) {
     }
     if (recvbuf[5] != -6) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[5] = %d; should be %d\n", recvbuf[5], -6);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[5] = %d; should be %d\n", recvbuf[5], -6);
+        }
     }
 
     MPI_Type_free(&mystruct);
     }
 
     MPI_Type_free(&mystruct);
@@ -178,74 +185,74 @@ int vector_negstride_test(void)
 
     err = MPI_Type_vector(2, 1, -1, MPI_INT, &myvector);
     if (err != MPI_SUCCESS) {
 
     err = MPI_Type_vector(2, 1, -1, MPI_INT, &myvector);
     if (err != MPI_SUCCESS) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "MPI_Type_vector returned error\n");
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "MPI_Type_vector returned error\n");
+        }
     }
 
     MPI_Type_commit(&myvector);
 
     }
 
     MPI_Type_commit(&myvector);
 
-    err = MPI_Irecv(recvbuf+1, 4, MPI_INT, 0, 0, MPI_COMM_SELF, &request);
+    err = MPI_Irecv(recvbuf + 1, 4, MPI_INT, 0, 0, MPI_COMM_SELF, &request);
     if (err != MPI_SUCCESS) {
     if (err != MPI_SUCCESS) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "MPI_Irecv returned error\n");
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "MPI_Irecv returned error\n");
+        }
     }
 
     }
 
-    err = MPI_Send(sendbuf+2, 2, myvector, 0, 0, MPI_COMM_SELF);
+    err = MPI_Send(sendbuf + 2, 2, myvector, 0, 0, MPI_COMM_SELF);
     if (err != MPI_SUCCESS) {
     if (err != MPI_SUCCESS) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "MPI_Send returned error\n");
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "MPI_Send returned error\n");
+        }
     }
 
     err = MPI_Wait(&request, &status);
     if (err != MPI_SUCCESS) {
     }
 
     err = MPI_Wait(&request, &status);
     if (err != MPI_SUCCESS) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "MPI_Wait returned error\n");
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "MPI_Wait returned error\n");
+        }
     }
 
     /* verify data */
     if (recvbuf[0] != -1) {
     }
 
     /* verify data */
     if (recvbuf[0] != -1) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[0] = %d; should be %d\n", recvbuf[0], -1);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[0] = %d; should be %d\n", recvbuf[0], -1);
+        }
     }
     if (recvbuf[1] != 3) {
     }
     if (recvbuf[1] != 3) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[1] = %d; should be %d\n", recvbuf[1], 3);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[1] = %d; should be %d\n", recvbuf[1], 3);
+        }
     }
     if (recvbuf[2] != 2) {
     }
     if (recvbuf[2] != 2) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[2] = %d; should be %d\n", recvbuf[2], 2);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[2] = %d; should be %d\n", recvbuf[2], 2);
+        }
     }
     if (recvbuf[3] != 5) {
     }
     if (recvbuf[3] != 5) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[3] = %d; should be %d\n", recvbuf[3], 5);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[3] = %d; should be %d\n", recvbuf[3], 5);
+        }
     }
     if (recvbuf[4] != 4) {
     }
     if (recvbuf[4] != 4) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[4] = %d; should be %d\n", recvbuf[4], 4);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[4] = %d; should be %d\n", recvbuf[4], 4);
+        }
     }
     if (recvbuf[5] != -6) {
     }
     if (recvbuf[5] != -6) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[5] = %d; should be %d\n", recvbuf[5], -6);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[5] = %d; should be %d\n", recvbuf[5], -6);
+        }
     }
 
     MPI_Type_free(&myvector);
     }
 
     MPI_Type_free(&myvector);
@@ -266,79 +273,79 @@ int indexed_negdisp_test(void)
     MPI_Request request;
     MPI_Status status;
 
     MPI_Request request;
     MPI_Status status;
 
-    int disps[2]     = { 0, -1 };
-    int blks[2]           = { 1, 1 };
+    int disps[2] = { 0, -1 };
+    int blks[2] = { 1, 1 };
 
     err = MPI_Type_indexed(2, blks, disps, MPI_INT, &myindexed);
     if (err != MPI_SUCCESS) {
 
     err = MPI_Type_indexed(2, blks, disps, MPI_INT, &myindexed);
     if (err != MPI_SUCCESS) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "MPI_Type_indexed returned error\n");
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "MPI_Type_indexed returned error\n");
+        }
     }
 
     MPI_Type_commit(&myindexed);
 
     }
 
     MPI_Type_commit(&myindexed);
 
-    err = MPI_Irecv(recvbuf+1, 4, MPI_INT, 0, 0, MPI_COMM_SELF, &request);
+    err = MPI_Irecv(recvbuf + 1, 4, MPI_INT, 0, 0, MPI_COMM_SELF, &request);
     if (err != MPI_SUCCESS) {
     if (err != MPI_SUCCESS) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "MPI_Irecv returned error\n");
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "MPI_Irecv returned error\n");
+        }
     }
 
     }
 
-    err = MPI_Send(sendbuf+2, 2, myindexed, 0, 0, MPI_COMM_SELF);
+    err = MPI_Send(sendbuf + 2, 2, myindexed, 0, 0, MPI_COMM_SELF);
     if (err != MPI_SUCCESS) {
     if (err != MPI_SUCCESS) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "MPI_Send returned error\n");
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "MPI_Send returned error\n");
+        }
     }
 
     err = MPI_Wait(&request, &status);
     if (err != MPI_SUCCESS) {
     }
 
     err = MPI_Wait(&request, &status);
     if (err != MPI_SUCCESS) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "MPI_Wait returned error\n");
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "MPI_Wait returned error\n");
+        }
     }
 
     /* verify data */
     if (recvbuf[0] != -1) {
     }
 
     /* verify data */
     if (recvbuf[0] != -1) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[0] = %d; should be %d\n", recvbuf[0], -1);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[0] = %d; should be %d\n", recvbuf[0], -1);
+        }
     }
     if (recvbuf[1] != 3) {
     }
     if (recvbuf[1] != 3) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[1] = %d; should be %d\n", recvbuf[1], 3);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[1] = %d; should be %d\n", recvbuf[1], 3);
+        }
     }
     if (recvbuf[2] != 2) {
     }
     if (recvbuf[2] != 2) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[2] = %d; should be %d\n", recvbuf[2], 2);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[2] = %d; should be %d\n", recvbuf[2], 2);
+        }
     }
     if (recvbuf[3] != 5) {
     }
     if (recvbuf[3] != 5) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[3] = %d; should be %d\n", recvbuf[3], 5);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[3] = %d; should be %d\n", recvbuf[3], 5);
+        }
     }
     if (recvbuf[4] != 4) {
     }
     if (recvbuf[4] != 4) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[4] = %d; should be %d\n", recvbuf[4], 4);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[4] = %d; should be %d\n", recvbuf[4], 4);
+        }
     }
     if (recvbuf[5] != -6) {
     }
     if (recvbuf[5] != -6) {
-       errs++;
-       if (verbose) {
-           fprintf(stderr, "recvbuf[5] = %d; should be %d\n", recvbuf[5], -6);
-       }
+        errs++;
+        if (verbose) {
+            fprintf(stderr, "recvbuf[5] = %d; should be %d\n", recvbuf[5], -6);
+        }
     }
 
     MPI_Type_free(&myindexed);
     }
 
     MPI_Type_free(&myindexed);
@@ -380,39 +387,41 @@ int struct_struct_test(void)
      * arrays are row-major.  So we invert the order of dimensions. */
 #define N (2)
 #define M (4)
      * arrays are row-major.  So we invert the order of dimensions. */
 #define N (2)
 #define M (4)
-    int array[N][M] =    { {-1, -1, -1, -1}, {-1, -1, -1, -1} };
-    int expected[N][M] = { {-1,  1,  2,  5}, {-1,  3,  4,  6} };
-    int seq_array[N*M];
+    int array[N][M] = { {-1, -1, -1, -1}, {-1, -1, -1, -1} };
+    int expected[N][M] = { {-1, 1, 2, 5}, {-1, 3, 4, 6} };
+    int seq_array[N * M];
     MPI_Aint astart, aend;
     MPI_Aint size_exp = 0;
 
     /* 1st section selects elements 1 and 2 out of 2nd dimension, complete 1st dim.
      * should receive the values 1, 2, 3, 4 */
     astart = 1;
     MPI_Aint astart, aend;
     MPI_Aint size_exp = 0;
 
     /* 1st section selects elements 1 and 2 out of 2nd dimension, complete 1st dim.
      * should receive the values 1, 2, 3, 4 */
     astart = 1;
-    aend   = 2;
+    aend = 2;
     err = build_array_section_type(M, astart, aend, &types[0]);
     if (err) {
         errs++;
     err = build_array_section_type(M, astart, aend, &types[0]);
     if (err) {
         errs++;
-        if (verbose) fprintf(stderr, "build_array_section_type failed\n");
+        if (verbose)
+            fprintf(stderr, "build_array_section_type failed\n");
         return errs;
     }
     blens[0] = N;
     displ[0] = 0;
         return errs;
     }
     blens[0] = N;
     displ[0] = 0;
-    size_exp = size_exp + N * (aend-astart+1) * sizeof(int);
+    size_exp = size_exp + N * (aend - astart + 1) * sizeof(int);
 
     /* 2nd section selects last element of 2nd dimension, complete 1st dim.
      * should receive the values 5, 6 */
     astart = 3;
 
     /* 2nd section selects last element of 2nd dimension, complete 1st dim.
      * should receive the values 5, 6 */
     astart = 3;
-    aend   = 3;
+    aend = 3;
     err = build_array_section_type(M, astart, aend, &types[1]);
     if (err) {
         errs++;
     err = build_array_section_type(M, astart, aend, &types[1]);
     if (err) {
         errs++;
-        if (verbose) fprintf(stderr, "build_array_section_type failed\n");
+        if (verbose)
+            fprintf(stderr, "build_array_section_type failed\n");
         return errs;
     }
     blens[1] = N;
     displ[1] = 0;
         return errs;
     }
     blens[1] = N;
     displ[1] = 0;
-    size_exp = size_exp + N * (aend-astart+1) * sizeof(int);
+    size_exp = size_exp + N * (aend - astart + 1) * sizeof(int);
 
     /* create type */
     err = MPI_Type_create_struct(COUNT, blens, displ, types, &datatype);
 
     /* create type */
     err = MPI_Type_create_struct(COUNT, blens, displ, types, &datatype);
@@ -424,14 +433,15 @@ int struct_struct_test(void)
     check_err(MPI_Type_size);
     if (dt_size != size_exp) {
         errs++;
     check_err(MPI_Type_size);
     if (dt_size != size_exp) {
         errs++;
-        if (verbose) fprintf(stderr, "unexpected type size\n");
+        if (verbose)
+            fprintf(stderr, "unexpected type size\n");
     }
 
 
     /* send the type to ourselves to make sure that the type describes data correctly */
     }
 
 
     /* send the type to ourselves to make sure that the type describes data correctly */
-    for (i = 0; i < (N*M) ; ++i)
-        seq_array[i] = i + 1; /* source values 1..(N*M) */
-    err = MPI_Isend(&seq_array[0], dt_size/sizeof(int), MPI_INT, 0, 42, MPI_COMM_SELF, &req[0]);
+    for (i = 0; i < (N * M); ++i)
+        seq_array[i] = i + 1;   /* source values 1..(N*M) */
+    err = MPI_Isend(&seq_array[0], dt_size / sizeof(int), MPI_INT, 0, 42, MPI_COMM_SELF, &req[0]);
     check_err(MPI_Isend);
     err = MPI_Irecv(&array[0][0], 1, datatype, 0, 42, MPI_COMM_SELF, &req[1]);
     check_err(MPI_Irecv);
     check_err(MPI_Isend);
     err = MPI_Irecv(&array[0][0], 1, datatype, 0, 42, MPI_COMM_SELF, &req[1]);
     check_err(MPI_Irecv);
@@ -444,7 +454,8 @@ int struct_struct_test(void)
             if (array[i][j] != expected[i][j]) {
                 errs++;
                 if (verbose)
             if (array[i][j] != expected[i][j]) {
                 errs++;
                 if (verbose)
-                    fprintf(stderr, "array[%d][%d]=%d, should be %d\n", i, j, array[i][j], expected[i][j]);
+                    fprintf(stderr, "array[%d][%d]=%d, should be %d\n", i, j, array[i][j],
+                            expected[i][j]);
             }
         }
     }
             }
         }
     }
@@ -477,7 +488,7 @@ int struct_struct_test(void)
      1D array   ###############################
      datatype   LB      ###########             UB
  */
      1D array   ###############################
      datatype   LB      ###########             UB
  */
-int build_array_section_type(MPI_Aint aext, MPI_Aint astart, MPI_Aint aend, MPI_Datatype *datatype)
+int build_array_section_type(MPI_Aint aext, MPI_Aint astart, MPI_Aint aend, MPI_Datatype * datatype)
 {
 #define COUNT (3)
     int err, errs = 0;
 {
 #define COUNT (3)
     int err, errs = 0;
@@ -516,8 +527,7 @@ int build_array_section_type(MPI_Aint aext, MPI_Aint astart, MPI_Aint aend, MPI_
 
 /* start_idx is the "zero" point for the unpack */
 static int pack_and_check_expected(MPI_Datatype type, const char *name,
 
 /* start_idx is the "zero" point for the unpack */
 static int pack_and_check_expected(MPI_Datatype type, const char *name,
-                                   int start_idx, int size,
-                                   int *array, int *expected)
+                                   int start_idx, int size, int *array, int *expected)
 {
     int i;
     int err, errs = 0;
 {
     int i;
     int err, errs = 0;
@@ -525,19 +535,21 @@ static int pack_and_check_expected(MPI_Datatype type, const char *name,
     int *pack_buf = NULL;
     int pos;
     int type_size = -1;
     int *pack_buf = NULL;
     int pos;
     int type_size = -1;
-    int sendbuf[8] = {0,1,2,3,4,5,6,7};
+    int sendbuf[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
 
     err = MPI_Type_size(type, &type_size);
     check_err(MPI_Type_size);
     assert(sizeof(sendbuf) >= type_size);
 
 
     err = MPI_Type_size(type, &type_size);
     check_err(MPI_Type_size);
     assert(sizeof(sendbuf) >= type_size);
 
-    err = MPI_Pack_size(type_size/sizeof(int), MPI_INT, MPI_COMM_SELF, &pack_size);
+    err = MPI_Pack_size(type_size / sizeof(int), MPI_INT, MPI_COMM_SELF, &pack_size);
     check_err(MPI_Pack_size);
     pack_buf = malloc(pack_size);
     check_err(MPI_Pack_size);
     pack_buf = malloc(pack_size);
-    assert(pack_buf!=NULL);
+    assert(pack_buf);
 
     pos = 0;
 
     pos = 0;
-    err = MPI_Pack(&sendbuf[0], type_size/sizeof(int), MPI_INT, pack_buf, pack_size, &pos, MPI_COMM_SELF);
+    err =
+        MPI_Pack(&sendbuf[0], type_size / sizeof(int), MPI_INT, pack_buf, pack_size, &pos,
+                 MPI_COMM_SELF);
     check_err(MPI_Pack);
     pos = 0;
     err = MPI_Unpack(pack_buf, pack_size, &pos, &array[start_idx], 1, type, MPI_COMM_SELF);
     check_err(MPI_Pack);
     pos = 0;
     err = MPI_Unpack(pack_buf, pack_size, &pos, &array[start_idx], 1, type, MPI_COMM_SELF);
@@ -564,8 +576,8 @@ int flatten_test(void)
 #define ARR_SIZE (9)
     /* real indices              0  1  2  3  4  5  6  7  8
      * indices w/ &array[3]     -3 -2 -1  0  1  2  3  4  5 */
 #define ARR_SIZE (9)
     /* real indices              0  1  2  3  4  5  6  7  8
      * indices w/ &array[3]     -3 -2 -1  0  1  2  3  4  5 */
-    int array[ARR_SIZE]      = {-1,-1,-1,-1,-1,-1,-1,-1,-1};
-    int expected[ARR_SIZE]   = {-1, 0, 1,-1, 2,-1, 3,-1, 4};
+    int array[ARR_SIZE] = { -1, -1, -1, -1, -1, -1, -1, -1, -1 };
+    int expected[ARR_SIZE] = { -1, 0, 1, -1, 2, -1, 3, -1, 4 };
     MPI_Datatype idx_type = MPI_DATATYPE_NULL;
     MPI_Datatype blkidx_type = MPI_DATATYPE_NULL;
     MPI_Datatype combo = MPI_DATATYPE_NULL;
     MPI_Datatype idx_type = MPI_DATATYPE_NULL;
     MPI_Datatype blkidx_type = MPI_DATATYPE_NULL;
     MPI_Datatype combo = MPI_DATATYPE_NULL;
@@ -582,9 +594,9 @@ int flatten_test(void)
      * different blens to prevent optimization into a blockindexed
      */
     blens[0] = 2;
      * different blens to prevent optimization into a blockindexed
      */
     blens[0] = 2;
-    displ[0] = -2; /* elements, puts byte after block end at 0 */
+    displ[0] = -2;      /* elements, puts byte after block end at 0 */
     blens[1] = 1;
     blens[1] = 1;
-    displ[1] = 1; /*elements*/
+    displ[1] = 1;       /*elements */
 
     err = MPI_Type_indexed(COUNT, blens, displ, MPI_INT, &idx_type);
     check_err(MPI_Type_indexed);
 
     err = MPI_Type_indexed(COUNT, blens, displ, MPI_INT, &idx_type);
     check_err(MPI_Type_indexed);
@@ -606,13 +618,13 @@ int flatten_test(void)
      * II_I_B_B  (I=idx_type, B=blkidx_type)
      * 21012345  <-- pos (left of 0 is neg)
      */
      * II_I_B_B  (I=idx_type, B=blkidx_type)
      * 21012345  <-- pos (left of 0 is neg)
      */
-    blens[0]  = 1;
-    adispl[0] = 0; /*bytes*/
-    types[0]  = idx_type;
+    blens[0] = 1;
+    adispl[0] = 0;      /*bytes */
+    types[0] = idx_type;
 
 
-    blens[1]  = 1;
-    adispl[1] = 4 * sizeof(int); /* bytes */
-    types[1]  = blkidx_type;
+    blens[1] = 1;
+    adispl[1] = 4 * sizeof(int);        /* bytes */
+    types[1] = blkidx_type;
 
     /* must be a struct in order to trigger flattening code */
     err = MPI_Type_create_struct(COUNT, blens, adispl, types, &combo);
 
     /* must be a struct in order to trigger flattening code */
     err = MPI_Type_create_struct(COUNT, blens, adispl, types, &combo);
@@ -630,23 +642,24 @@ int flatten_test(void)
     return errs;
 #undef COUNT
 }
     return errs;
 #undef COUNT
 }
+
 #undef check_err
 
 int parse_args(int argc, char **argv)
 {
     /*
 #undef check_err
 
 int parse_args(int argc, char **argv)
 {
     /*
-    int ret;
-
-    while ((ret = getopt(argc, argv, "v")) >= 0)
-    {
-       switch (ret) {
-           case 'v':
-               verbose = 1;
-               break;
-       }
-    }
-    */
+     * int ret;
+     *
+     * while ((ret = getopt(argc, argv, "v")) >= 0)
+     * {
+     * switch (ret) {
+     * case 'v':
+     * verbose = 1;
+     * break;
+     * }
+     * }
+     */
     if (argc > 1 && strcmp(argv[1], "-v") == 0)
     if (argc > 1 && strcmp(argv[1], "-v") == 0)
-       verbose = 1;
+        verbose = 1;
     return 0;
 }
     return 0;
 }