1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
4 * (C) 2013 by Argonne National Laboratory.
5 * See COPYRIGHT in top-level directory.
12 int test_count(MPI_Count count)
15 int cancelled, cancelled2;
16 MPI_Count bcount, bcount2;
21 MPI_Status_set_cancelled(&stat, cancelled);
22 MPI_Status_set_elements_x(&stat, MPI_BYTE, bcount);
23 MPI_Get_elements_x(&stat, MPI_BYTE, &bcount2);
24 MPI_Test_cancelled(&stat, &cancelled2);
25 if (bcount != bcount2) {
26 fprintf(stderr, "Count Error: expected %lx, got %lx\n", bcount, bcount2);
29 if (cancelled != cancelled2) {
30 fprintf(stderr, "Cancelled Error: expected %d, got %d\n", cancelled, cancelled2);
36 int main(int argc, char **argv)
40 MPI_Init(&argc, &argv);
41 /* baseline: this tiny value should pose no problems */
42 nerrors += test_count(60);
43 /* one with no next-to-high-bits set */
44 nerrors += test_count(0x3654321f71234567);
45 /* masking after shift can help the count_high, but count_low is still
47 nerrors += test_count(0x7654321f71234567);
48 /* original problematic count reported by Artem Yalozo */
49 nerrors += test_count(0x7654321ff1234567);
52 fprintf(stderr, "found %d errors\n", nerrors);
55 printf(" No Errors\n");