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 %llx, got %llx\n",
27 (long long int) bcount, (long long int) bcount2);
30 if (cancelled != cancelled2) {
31 fprintf(stderr, "Cancelled Error: expected %d, got %d\n", cancelled, cancelled2);
37 int main(int argc, char **argv)
41 MPI_Init(&argc, &argv);
42 /* baseline: this tiny value should pose no problems */
43 nerrors += test_count(60);
44 /* one with no next-to-high-bits set */
45 nerrors += test_count(0x3654321f71234567);
46 /* masking after shift can help the count_high, but count_low is still
48 nerrors += test_count(0x7654321f71234567);
49 /* original problematic count reported by Artem Yalozo */
50 nerrors += test_count(0x7654321ff1234567);
53 fprintf(stderr, "found %d errors\n", nerrors);
56 printf(" No Errors\n");