arpack-ng icon indicating copy to clipboard operation
arpack-ng copied to clipboard

Tests fail to build with LTO

Open eli-schwartz opened this issue 1 year ago • 1 comments

I tried to build arpack and run its tests using LTO with these *FLAGS: -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing

It failed while compiling the test programs:

/bin/sh ../libtool  --tag=F77   --mode=link x86_64-pc-linux-gnu-gfortran  -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-clash-protection -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing  -Wl,-O1 -Wl,--as-needed -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,--defsym=__gentoo_check_ldflags__=0 -o dnsimp dnsimp.o mmio.o ../SRC/libarpack.la -llapack -lblas 
libtool: link: x86_64-pc-linux-gnu-gfortran -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-clash-protection -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,-O1 -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,--defsym=__gentoo_check_ldflags__=0 -o .libs/dnsimp dnsimp.o mmio.o  -Wl,--as-needed ../SRC/.libs/libarpack.so //usr/lib/gcc/x86_64-pc-linux-gnu/13/libquadmath.so -lm -llapack -lblas
dnsimp.f:196:72: error: type of 'mmread' does not match original declaration [-Werror=lto-type-mismatch]
  196 |      *           temp,temp,temp,A,temp)
      |                                                                        ^
mmio.f:1:23: note: 'mmread' was previously declared here
    1 |       subroutine mmread(iunit,rep,field,symm,rows,cols,nnz,nnzmax,
      |                       ^
mmio.f:1:23: note: code may be misoptimized unless '-fno-strict-aliasing' is used
lto1: some warnings being treated as errors
lto-wrapper: fatal error: x86_64-pc-linux-gnu-gfortran returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

Downstream bug report: https://bugs.gentoo.org/878139 Full build log: build.log

eli-schwartz avatar Mar 06 '24 03:03 eli-schwartz

Does your BLAS/LAPACK supports LTO? Feel free to PR a fix if you find one.

fghoussen avatar Mar 06 '24 19:03 fghoussen