fat_init violates host ABI on Win64

Marco Bodrato bodrato at mail.dm.unipi.it
Wed Apr 26 16:54:36 UTC 2017


Ciao,

Il Mer, 26 Aprile 2017 12:25 pm, Nicolas Hake ha scritto:
> Torbjörn Granlund wrote:
>> Where do we (unconditionally) rely on variable-length arrays?
>
> mpn/generic/sqrlo_basecase.c line 153, where SQRLO_BASECASE_ALLOC is a
> non-constant expression by ultimately referencing CPUVEC_THRESHOLD if
> fat.h is included.

You are right, we should define a costant SQRLO_DC_THRESHOLD_LIMIT not
only for the TUNE builds, but for FAT too...

For sqrlo_basecase a patch like the following should work.

diff -r 021277dcb21f gmp-impl.h
--- a/gmp-impl.h	Tue Apr 18 23:47:55 2017 +0200
+++ b/gmp-impl.h	Wed Apr 26 18:27:38 2017 +0200
@@ -5018,7 +5018,6 @@
 #undef MUL_TOOM33_THRESHOLD_LIMIT
 #undef MULLO_BASECASE_THRESHOLD_LIMIT
 #undef SQRLO_BASECASE_THRESHOLD_LIMIT
-#undef SQRLO_DC_THRESHOLD_LIMIT
 #undef SQR_TOOM3_THRESHOLD_LIMIT
 #define SQR_TOOM2_MAX_GENERIC           200
 #define MUL_TOOM22_THRESHOLD_LIMIT      700
@@ -5032,12 +5031,16 @@
 #define SQR_TOOM8_THRESHOLD_LIMIT      1200
 #define MULLO_BASECASE_THRESHOLD_LIMIT  200
 #define SQRLO_BASECASE_THRESHOLD_LIMIT  200
-#define SQRLO_DC_THRESHOLD_LIMIT        400
 #define GET_STR_THRESHOLD_LIMIT         150
 #define FAC_DSC_THRESHOLD_LIMIT        2048

 #endif /* TUNE_PROGRAM_BUILD */

+#if TUNE_PROGRAM_BUILD || WANT_FAT_BINARY
+#undef SQRLO_DC_THRESHOLD_LIMIT
+#define SQRLO_DC_THRESHOLD_LIMIT        400
+#endif
+
 #if defined (__cplusplus)
 }
 #endif


Regards,
m

-- 
http://bodrato.it/papers/



More information about the gmp-bugs mailing list