Macaulay2 / M2

The primary source code repository for Macaulay2, a system for computing in commutative algebra, algebraic geometry and related fields.
https://macaulay2.com
347 stars 231 forks source link

cannot convert ‘__vector(4) __bool int’ to ‘unsigned int’ #1901

Closed d-torrance closed 3 years ago

d-torrance commented 3 years ago

From a PPA build of the development branch in Ubuntu 20.04 on ppc64el:

g++ -pipe -Wall -Wno-shadow -Wcast-qual -Wno-sign-conversion -Wno-sign-compare -Wno-parentheses -Wno-sign-compare  -fno-stack-protector -Wuninitialized -I/usr/include  -Wno-error=pragmas -std=gnu++14 -g -fdebug-prefix-map=/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204=. -fstack-protector-strong -Wformat -Werror=format-security -g3 -O2  -Wno-unused-local-typedefs -Wno-unknown-pragmas -std=c++17 -Wno-mismatched-tags -I. -DNDEBUG -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/usr-host/include  -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/usr-host/include  -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/usr-host/include  -Wdate-time -D_FORTIFY_SOURCE=2 -isystem /usr/include/libxml2   -DSING_NDEBUG -DOM_NDEBUG -DSING_NDEBUG -DOM_NDEBUG -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular   -I/usr/src/gtest  -Wdate-time -D_FORTIFY_SOURCE=2 -DNDEBUG  -I/usr/include/cdd -I/usr/include/eigen3 -I/usr/include -DBOOST_STACKTRACE_LINK -isystem /usr/include/libxml2   -DSING_NDEBUG -DOM_NDEBUG -DSING_NDEBUG -DOM_NDEBUG -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular   -I/usr/src/gtest  -Wdate-time -D_FORTIFY_SOURCE=2 -DNDEBUG  -I/usr/include/cdd -I/usr/include/eigen3 -I/usr/include -DBOOST_STACKTRACE_LINK -isystem /usr/include/libxml2   -DSING_NDEBUG -DOM_NDEBUG -DSING_NDEBUG -DOM_NDEBUG -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular   -I/usr/src/gtest  -Wdate-time -D_FORTIFY_SOURCE=2 -DNDEBUG  -I/usr/include/cdd -I/usr/include/eigen3 -I/usr/include -DBOOST_STACKTRACE_LINK -I../d -I./../c -Wno-fatal-errors  -c -Wno-cast-qual VectorArithmetic.cpp -o VectorArithmetic.o
In file included from MemoryBlock.hpp:8,
                 from VectorArithmetic.hpp:6,
                 from VectorArithmetic.cpp:1:
/usr/include/tbb/tbb.h:21:154: note: #pragma message: TBB Warning: tbb.h contains deprecated functionality. For details, please see Deprecated Features appendix in the TBB reference manual.
   21 | #pragma message("TBB Warning: tbb.h contains deprecated functionality. For details, please see Deprecated Features appendix in the TBB reference manual.")
      |                                                                                                                                                          ^
In file included from /usr/include/fflas-ffpack/fflas/fflas.h:69,
                 from /usr/include/fflas-ffpack/ffpack/ffpack.h:45,
                 from aring-zzp-ffpack.hpp:21,
                 from aring-translate.hpp:18,
                 from aring-glue.hpp:7,
                 from VectorArithmetic.hpp:10,
                 from VectorArithmetic.cpp:1:
/usr/include/fflas-ffpack/utils/fflas_memory.h: In function ‘__vector(4) __bool int FFLAS::alignable()’:
/usr/include/fflas-ffpack/utils/fflas_memory.h:48:16: error: cannot convert ‘bool’ to ‘__vector(4) __bool int’ in return
   48 |         return true ;
      |                ^~~~
/usr/include/fflas-ffpack/utils/fflas_memory.h: At global scope:
/usr/include/fflas-ffpack/utils/fflas_memory.h:53:17: error: template-id ‘alignable<Givaro::Integer*>’ for ‘unsigned int FFLAS::alignable()’ does not match any template declaration
   53 |     inline bool alignable<Givaro::Integer*>() {
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/fflas-ffpack/utils/fflas_memory.h:47:17: note: candidate is: ‘template<class Element> __vector(4) __bool int FFLAS::alignable()’
   47 |     inline bool alignable() {
      |                 ^~~~~~~~~
...

This is followed by many, many more warning and error messages. See the log for more.

d-torrance commented 3 years ago

Same error message, but in a gmp header instead of a fflas-ffpack one, in Ubuntu 18.04 (also ppc64el):

g++ -pipe -Wall -Wno-shadow -Wcast-qual -Wno-sign-conversion -Wno-sign-compare -Wno-parentheses -Wno-sign-compare  -fno-stack-protector -Wuninitialized -I/usr/include  -Wno-error=pragmas -std=gnu++14 -g -fdebug-prefix-map=/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204=. -fstack-protector-strong -Wformat -Werror=format-security -g3 -O2  -Wno-unused-local-typedefs -Wno-unknown-pragmas -std=c++17 -Wno-mismatched-tags -I. -DNDEBUG -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/usr-host/include  -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/usr-host/include  -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202101300204/M2/usr-host/include  -Wdate-time -D_FORTIFY_SOURCE=2 -isystem /usr/include/libxml2   -DSING_NDEBUG -DOM_NDEBUG -DSING_NDEBUG -DOM_NDEBUG -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular   -I/usr/src/gtest  -Wdate-time -D_FORTIFY_SOURCE=2 -DNDEBUG  -I/usr/include/cdd -I/usr/include/eigen3 -I/usr/include -DBOOST_STACKTRACE_LINK -isystem /usr/include/libxml2   -DSING_NDEBUG -DOM_NDEBUG -DSING_NDEBUG -DOM_NDEBUG -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular   -I/usr/src/gtest  -Wdate-time -D_FORTIFY_SOURCE=2 -DNDEBUG  -I/usr/include/cdd -I/usr/include/eigen3 -I/usr/include -DBOOST_STACKTRACE_LINK -isystem /usr/include/libxml2   -DSING_NDEBUG -DOM_NDEBUG -DSING_NDEBUG -DOM_NDEBUG -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular -I/usr/include/powerpc64le-linux-gnu/singular -I/usr/include/singular   -I/usr/src/gtest  -Wdate-time -D_FORTIFY_SOURCE=2 -DNDEBUG  -I/usr/include/cdd -I/usr/include/eigen3 -I/usr/include -DBOOST_STACKTRACE_LINK -I../d -I./../c -Wno-fatal-errors  -c -Wno-cast-qual VectorArithmetic.cpp -o VectorArithmetic.o
In file included from MemoryBlock.hpp:8:0,
                 from VectorArithmetic.hpp:6,
                 from VectorArithmetic.cpp:1:
/usr/include/tbb/tbb.h:21:154: note: #pragma message: TBB Warning: tbb.h contains deprecated functionality. For details, please see Deprecated Features appendix in the TBB reference manual.
 #pragma message("TBB Warning: tbb.h contains deprecated functionality. For details, please see Deprecated Features appendix in the TBB reference manual.")
                                                                                                                                                          ^
In file included from /usr/include/gmp++/gmp++.h:33:0,
                 from /usr/include/givaro/givinteger.h:19,
                 from /usr/include/fflas-ffpack/utils/fflas_memory.h:45,
                 from /usr/include/fflas-ffpack/fflas/fflas.h:71,
                 from /usr/include/fflas-ffpack/ffpack/ffpack.h:46,
                 from aring-zzp-ffpack.hpp:21,
                 from aring-translate.hpp:18,
                 from aring-glue.hpp:7,
                 from VectorArithmetic.hpp:10,
                 from VectorArithmetic.cpp:1:
/usr/include/gmpxx.h: In static member function ‘static __vector(4) __bool int __gmp_binary_equal::eval(mpz_srcptr, mpz_srcptr)’:
/usr/include/gmpxx.h:930:74: error: cannot convert ‘bool’ to ‘__vector(4) __bool int’ in return
   static bool eval(mpz_srcptr z, mpz_srcptr w) { return mpz_cmp(z, w) == 0; }
                                                                          ^
/usr/include/gmpxx.h: In static member function ‘static __vector(4) __bool int __gmp_binary_equal::eval(mpz_srcptr, long unsigned int)’:
/usr/include/gmpxx.h:933:32: error: cannot convert ‘bool’ to ‘__vector(4) __bool int’ in return
   { return mpz_cmp_ui(z, l) == 0; }
                                ^
/usr/include/gmpxx.h: In static member function ‘static __vector(4) __bool int __gmp_binary_equal::eval(mpz_srcptr, long int)’:
/usr/include/gmpxx.h:937:32: error: cannot convert ‘bool’ to ‘__vector(4) __bool int’ in return
   { return mpz_cmp_si(z, l) == 0; }
                                ^
/usr/include/gmpxx.h: In static member function ‘static __vector(4) __bool int __gmp_binary_equal::eval(mpz_srcptr, double)’:
/usr/include/gmpxx.h:941:31: error: cannot convert ‘bool’ to ‘__vector(4) __bool int’ in return
   { return mpz_cmp_d(z, d) == 0; }
                               ^
/usr/include/gmpxx.h: In static member function ‘static __vector(4) __bool int __gmp_binary_equal::eval(mpq_srcptr, mpq_srcptr)’:
/usr/include/gmpxx.h:946:31: error: cannot convert ‘bool’ to ‘__vector(4) __bool int’ in return
   { return mpq_equal(q, r) != 0; }
                               ^
/usr/include/gmpxx.h: In static member function ‘static __vector(4) __bool int __gmp_binary_equal::eval(mpq_srcptr, long unsigned int)’:
/usr/include/gmpxx.h:949:35: error: cannot convert ‘bool’ to ‘__vector(4) __bool int’ in return
   { return mpq_cmp_ui(q, l, 1) == 0; }
                                   ^
/usr/include/gmpxx.h: In static member function ‘static __vector(4) __bool int __gmp_binary_equal::eval(mpq_srcptr, long int)’:
/usr/include/gmpxx.h:953:35: error: cannot convert ‘bool’ to ‘__vector(4) __bool int’ in return
   { return mpq_cmp_si(q, l, 1) == 0; }
                                   ^
/usr/include/gmpxx.h: In static member function ‘static __vector(4) __bool int __gmp_binary_equal::eval(mpq_srcptr, double)’:
/usr/include/gmpxx.h:957:55: error: cannot convert ‘bool’ to ‘__vector(4) __bool int’ in return
   {  __GMPXX_TMPQ_D;    return mpq_equal (q, temp) != 0; }
                                                       ^
/usr/include/gmpxx.h: In static member function ‘static __vector(4) __bool int __gmp_binary_equal::eval(mpq_srcptr, mpz_srcptr)’:
/usr/include/gmpxx.h:961:31: error: cannot convert ‘bool’ to ‘__vector(4) __bool int’ in return
   { return mpq_cmp_z(q, z) == 0; }
                               ^
/usr/include/gmpxx.h: In static member function ‘static __vector(4) __bool int __gmp_binary_equal::eval(mpf_srcptr, mpf_srcptr)’:
/usr/include/gmpxx.h:965:74: error: cannot convert ‘bool’ to ‘__vector(4) __bool int’ in return
   static bool eval(mpf_srcptr f, mpf_srcptr g) { return mpf_cmp(f, g) == 0; }
                                                                          ^
/usr/include/gmpxx.h: In static member function ‘static __vector(4) __bool int __gmp_binary_equal::eval(mpf_srcptr, long unsigned int)’:
/usr/include/gmpxx.h:968:32: error: cannot convert ‘bool’ to ‘__vector(4) __bool int’ in return
   { return mpf_cmp_ui(f, l) == 0; }
...
d-torrance commented 3 years ago

It looks like this may stem from switching to -std=c++17 in https://github.com/Macaulay2/M2/commit/41d487cc17e6d6ea8044d34f00a1c35c894a284c, i.e., without using GNU extensions. (See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58241). I applied a patch using -std=gnu++17 instead to the PPA package -- we'll see how it goes.

Also, we're setting the C++ standard in two places -- in the d and e directory Makefiles in the above commit, but also in the configure script: https://github.com/Macaulay2/M2/blob/fed620f72da38e9cd61e37e064fc18fd6fa048e4/M2/configure.ac#L228

So we end up with both -std=gnu++14 and -std=c++17 in the build flags:

g++ -std=gnu++14 -g -ffile-prefix-map=/<<BUILDDIR>>/macaulay2-1.17.2.1+git202102071439=. -fstack-protector-strong -Wformat -Werror=format-security -g3 -O2  -Wno-mismatched-tags -pipe -Wall -Wno-shadow -Wcast-qual -Wno-sign-conversion -Wno-sign-compare -Wno-parentheses -Wno-sign-compare  -fno-stack-protector -Wuninitialized -I/usr/include  -Wno-error=pragmas -Wreturn-type -Wunused-function -Wfatal-errors -std=c++17 -Wno-unknown-pragmas -Wno-mismatched-tags -I. -I. -I./../e -I./../system -I./../../include -I./../c -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202102071439/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202102071439/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202102071439/M2/usr-host/include  -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202102071439/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202102071439/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202102071439/M2/usr-host/include  -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202102071439/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202102071439/M2/include -I/<<BUILDDIR>>/macaulay2-1.17.2.1+git202102071439/M2/usr-host/include  -Wdate-time -D_FORTIFY_SOURCE=2 -isystem /usr/include/libxml2   -DSING_NDEBUG -DOM_NDEBUG -DSING_NDEBUG -DOM_NDEBUG -I/usr/include/x86_64-linux-gnu/singular -I/usr/include/singular -I/usr/include/x86_64-linux-gnu/singular -I/usr/include/singular -I/usr/include/x86_64-linux-gnu/singular -I/usr/include/singular   -I/usr/src/gtest  -Wdate-time -D_FORTIFY_SOURCE=2 -DNDEBUG  -I/usr/include/cdd -I/usr/include/eigen3 -I/usr/include -DBOOST_STACKTRACE_LINK -isystem /usr/include/libxml2   -DSING_NDEBUG -DOM_NDEBUG -DSING_NDEBUG -DOM_NDEBUG -I/usr/include/x86_64-linux-gnu/singular -I/usr/include/singular -I/usr/include/x86_64-linux-gnu/singular -I/usr/include/singular -I/usr/include/x86_64-linux-gnu/singular -I/usr/include/singular   -I/usr/src/gtest  -Wdate-time -D_FORTIFY_SOURCE=2 -DNDEBUG  -I/usr/include/cdd -I/usr/include/eigen3 -I/usr/include -DBOOST_STACKTRACE_LINK -isystem /usr/include/libxml2   -DSING_NDEBUG -DOM_NDEBUG -DSING_NDEBUG -DOM_NDEBUG -I/usr/include/x86_64-linux-gnu/singular -I/usr/include/singular -I/usr/include/x86_64-linux-gnu/singular -I/usr/include/singular -I/usr/include/x86_64-linux-gnu/singular -I/usr/include/singular   -I/usr/src/gtest  -Wdate-time -D_FORTIFY_SOURCE=2 -DNDEBUG  -I/usr/include/cdd -I/usr/include/eigen3 -I/usr/include -DBOOST_STACKTRACE_LINK -DNDEBUG -Wno-unknown-pragmas -I./../e  -c -Wno-unused-value -Wno-unused-but-set-variable -Wno-maybe-uninitialized engine-tmp.cc -o engine.o

Is this intentional?

DanGrayson commented 3 years ago

I intend to stop setting the C++ standard in the configure script, now that we are setting it in the d and e Makefiles, for the benefit of Mike's code, because it applies only while compiling the libraries, and the libraries should have Makefiles that take care of that for them if it's important.

I assume the second -std command line option overrides the first.

d-torrance commented 3 years ago

I intend to stop setting the C++ standard in the configure script, now that we are setting it in the d and e Makefiles, for the benefit of Mike's code, because it applies only while compiling the libraries, and the libraries should have Makefiles that take care of that for them if it's important.

That makes sense.

I assume the second -std command line option overrides the first.

Yes -- from man gcc:

For options of the same specificity, the last one takes effect.

d-torrance commented 3 years ago

Switching to -std=gnu++17 as in #1923 indeed fixes the ppc64el build. (Ubuntu 18.04 and Ubuntu 20.04)