You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some compilation optimization options, such as the -Ofast option, cause a range of floating-point calculation errors that are permissible. However, the running result of the current csmith calculation program compares all bits and does not allow floating-point calculation errors.
Therefore, the source code of the csmith tool needs to be modified to allow certain errors in the calculation results of certain compilation optimization options.
Scheme
$ git diff runtime/csmith.h
diff --git a/runtime/csmith.h b/runtime/csmith.h
index 6ed44ff..0be747e 100644
--- a/runtime/csmith.h+++ b/runtime/csmith.h@@ -117,12 +117,15 @@ transparent_crc (uint64_t val, char* vname, int flag)
#endif
+#ifndef FLOAT_MASK+#define FLOAT_MASK 0xFFFFFFFF+#endif
static void
transparent_crc_bytes (char *ptr, int nbytes, char* vname, int flag)
{
int i;
for (i=0; i<nbytes; i++) {
- crc32_byte(ptr[i]);+ crc32_byte(ptr[i] & FLOAT_MASK);
}
if (flag) {
printf("...checksum after hashing %s : %lX\n", vname, crc32_context ^ 0xFFFFFFFFUL);
Background
Some compilation optimization options, such as the -Ofast option, cause a range of floating-point calculation errors that are permissible. However, the running result of the current csmith calculation program compares all bits and does not allow floating-point calculation errors.
Therefore, the source code of the csmith tool needs to be modified to allow certain errors in the calculation results of certain compilation optimization options.
Scheme
result
Floating-point error situation
The text was updated successfully, but these errors were encountered: