Re: fat_init violates host ABI on Win64

2017-04-26 Thread Marco Bodrato
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.hTue Apr 18 23:47:55 2017 +0200
+++ b/gmp-impl.hWed 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_LIMIT400
 #define GET_STR_THRESHOLD_LIMIT 150
 #define FAC_DSC_THRESHOLD_LIMIT2048

 #endif /* TUNE_PROGRAM_BUILD */

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


Regards,
m

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

___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: fat_init violates host ABI on Win64

2017-04-26 Thread Nicolas Hake

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.
mpn/generic/sqr_basecase.c line 170 has the same issue via 
SQR_TOOM2_THRESHOLD.


Both macros are constant if fat.h is not included.

Nicolas
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs