Hi, in integer/gcd/cl_I_gcd_aux2.cc there are the lines (starting at line 76): void partial_gcd (uintDD z1, uintDD z2, partial_gcd_result* erg) { var uintD x1 = 1; ... line 100: if (qx > (uintDD)(~x1)) { The compiler tells me that after taking the bitwise complement of x1, the (uintDD) cast will extend x1 by adding zeros, which is probably not the intention? See https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compil... Regards, Jan Rheinländer
Hi Jan,
line 100: if (qx > (uintDD)(~x1)) {
The compiler tells me that after taking the bitwise complement of x1, the (uintDD) cast will extend x1 by adding zeros, which is probably not the intention?
When you compare this line with the corresponding line 285 (for platforms without an uintDD type), you see that zero-extend is the intention here. More generally, unsigned integer types and zero-extend are the natural types/operations for the implementation of CLN. Signed integer types and sign-extend are not used so frequently. Bruno
Hi Bruno, thank you for explaining about the compiler warning. Here are two more: File include/cln/floatformat.h: It seems that with MSVC enums always have int as the underlying type. Therefore the compiler complains about truncation of a constant value for float_format_lfloat_max. But it is possible to force the type in this way: enum float_format_t : sintE { File src/base/cl_low.h line 1464: On MSVC x86 the macro "bit(32)" expands to "(1L << 32)" and the compiler says this is undefined behaviour. What about changing line 1464 to "(1ULL << 32)" instead? Like in line 1483. Jan
On 12.03.2018 20:20, Jan Rheinländer wrote:
thank you for explaining about the compiler warning. Here are two more:
File include/cln/floatformat.h:
It seems that with MSVC enums always have int as the underlying type.
Are you sure and are you using an up-to-date compiler version? ISO/IEC 14882:2014 says in 7.2: "For an enumeration whose underlying type is not fixed, the underlying type is an integral type that can represent all the enumerator values defined in the enumeration." -richy.
This page seems to indicate that it is a bug in MSVC (I use version 19 from Visual Studio 2015) https://stackoverflow.com/questions/2732085/is-there-a-way-to-make-enum-type... The MS documentation is not too clear about the underlying type of enumerations https://msdn.microsoft.com/en-us/library/2dzy4k6e.aspx But in the end, it's just a compiler warning. "make check" compiles successfully either way. Am 12.03.2018 um 21:01 schrieb Richard B. Kreckel:
On 12.03.2018 20:20, Jan Rheinländer wrote:
thank you for explaining about the compiler warning. Here are two more:
File include/cln/floatformat.h:
It seems that with MSVC enums always have int as the underlying type. Are you sure and are you using an up-to-date compiler version?
ISO/IEC 14882:2014 says in 7.2: "For an enumeration whose underlying type is not fixed, the underlying type is an integral type that can represent all the enumerator values defined in the enumeration."
-richy. _______________________________________________ CLN-list mailing list CLN-list@ginac.de https://www.cebix.net/mailman/listinfo/cln-list
participants (3)
-
Bruno Haible
-
Jan Rheinländer
-
Richard B. Kreckel