flintlib / flint

FLINT (Fast Library for Number Theory)
http://www.flintlib.org
GNU Lesser General Public License v3.0
444 stars 245 forks source link

Replace inline assembly with function prototypes in sanity check #2101

Open tobiasdiez opened 2 weeks ago

tobiasdiez commented 2 weeks ago

I get the following error:

C:\Users\Tobia\.conda\envs\sage-dev\Library\include\flint\fmpz_mpoly.h(1244): error C2664: '__int64 _mul128(__int64,__int64,__int64 *)': cannot convert argument 3 from 'mp_limb_t *' to '__int64 *'
C:\Users\Tobia\.conda\envs\sage-dev\Library\include\flint\fmpz_mpoly.h(1244): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include\intrin.h(941): note: see declaration of '_mul128'
C:\Users\Tobia\.conda\envs\sage-dev\Library\include\flint\fmpz_mpoly.h(1244): note: while trying to match the argument list '(mp_limb_signed_t, mp_limb_signed_t, mp_limb_t *)'
C:\Users\Tobia\.conda\envs\sage-dev\Library\include\flint\fmpz_mpoly.h(1245): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Tobia\.conda\envs\sage-dev\Library\include\flint\fmpz_mpoly.h(1253): error C2664: '__int64 _mul128(__int64,__int64,__int64 *)': cannot convert argument 3 from 'mp_limb_t *' to '__int64 *'
C:\Users\Tobia\.conda\envs\sage-dev\Library\include\flint\fmpz_mpoly.h(1253): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include\intrin.h(941): note: see declaration of '_mul128'
C:\Users\Tobia\.conda\envs\sage-dev\Library\include\flint\fmpz_mpoly.h(1253): note: while trying to match the argument list '(mp_limb_signed_t, mp_limb_signed_t, mp_limb_t *)'
C:\Users\Tobia\.conda\envs\sage-dev\Library\include\flint\fmpz_mpoly.h(1254): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Tobia\.conda\envs\sage-dev\Library\include\flint\calcium.h(155): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\Users\Tobia\.conda\envs\sage-dev\Library\include\flint\mpoly.h(33): warning C4244: 'initializing': conversion from 'double' to 'mp_limb_signed_t', possible loss of data
C:\Users\Tobia\.conda\envs\sage-dev\Library\include\flint\mpoly.h(974): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:/Users/Tobia/.conda/envs/sage-dev/Library/include\flint/long_extras.h(37): error C2664: '__int64 _mul128(__int64,__int64,__int64 *)': cannot convert argument 3 from 'mp_limb_t *' to '__int64 *'
C:/Users/Tobia/.conda/envs/sage-dev/Library/include\flint/long_extras.h(37): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include\intrin.h(941): note: see declaration of '_mul128'
C:/Users/Tobia/.conda/envs/sage-dev/Library/include\flint/long_extras.h(37): note: while trying to match the argument list '(mp_limb_signed_t, mp_limb_signed_t, mp_limb_t *)'
C:/Users/Tobia/.conda/envs/sage-dev/Library/include\flint/long_extras.h(39): warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:/Users/Tobia/.conda/envs/sage-dev/Library/include\flint/long_extras.h(54): error C2664: '__int64 _mul128(__int64,__int64,__int64 *)': cannot convert argument 3 from 'mp_limb_t *' to '__int64 *'
C:/Users/Tobia/.conda/envs/sage-dev/Library/include\flint/long_extras.h(54): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include\intrin.h(941): note: see declaration of '_mul128'
C:/Users/Tobia/.conda/envs/sage-dev/Library/include\flint/long_extras.h(54): note: while trying to match the argument list '(mp_limb_signed_t, mp_limb_signed_t, mp_limb_t *)'
C:/Users/Tobia/.conda/envs/sage-dev/Library/include\flint/long_extras.h(55): error C2664: '__int64 _mul128(__int64,__int64,__int64 *)': cannot convert argument 3 from 'mp_limb_t *' to '__int64 *'
C:/Users/Tobia/.conda/envs/sage-dev/Library/include\flint/long_extras.h(55): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include\intrin.h(941): note: see declaration of '_mul128'

with __MACHINEX64(__int64 _mul128(__int64 _Multiplier, __int64 _Multiplicand, __int64 * _HighProduct)) being the definition in MSVC.

albinahlback commented 2 weeks ago

Those errors can safely be ignored, but they should be fixed. We should sanity check without the use of assembly to make compiler recognize these warnings.

albinahlback commented 2 weeks ago

Perhaps not. Perhaps one should simply try casting instead. I'll investigate this in a week or two.