Skip to content

Commit a4c4f80

Browse files
author
Valentin Petrov
committed
Fixes MPI_LONG_DOUBLE array check
It is incorrect to use memcmp (at least on x86) for MPI_LONG_DOUBLE comparison since on x86 long double representation is 10 bytes + 6bytes padding. This padding will produce erros when doing memcmp with 16 bytes. Signed-off-by: Valentin Petrov <[email protected]>
1 parent ebb7d04 commit a4c4f80

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tst_types.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,11 @@ int tst_type_cmpvalue (int type, const char * buffer1, const char * buffer2)
10501050
printf ("buffer1:%p buf1:%p buffer2:%p buf2:%p lb:%d\n",
10511051
buffer1, buf1, buffer2, buf2, tst_type_gettypelb(type));
10521052
*/
1053-
return memcmp (buf1, buf2, tst_type_gettypesize (type));
1053+
if (tst_type_gettypeclass(type) == TST_MPI_LONG_DOUBLE) {
1054+
return *((long double*)buffer1) != *((long double*)buffer2);
1055+
} else {
1056+
return memcmp (buf1, buf2, tst_type_gettypesize (type));
1057+
}
10541058
}
10551059

10561060
int tst_type_checkstandardarray (int type, int values_num, char * buffer, int comm_rank)

0 commit comments

Comments
 (0)