The 4.8.1 branch fails to build CP2K in LTO mode. At linking, the following error message appears: /data/vjoost/clean/cp2k/cp2k/makefiles/../src/dbcsr_lib/dbcsr_blas_operations.F:64: error: undefined reference to 'iseed.2556.979179.13933' /data/vjoost/clean/cp2k/cp2k/makefiles/../src/dbcsr_lib/dbcsr_blas_operations.F:62: error: undefined reference to 'iseed.2556.979179.13933' /data/vjoost/clean/cp2k/cp2k/makefiles/../src/dbcsr_lib/dbcsr_blas_operations.F:58: error: undefined reference to 'iseed.2556.979179.13933' /data/vjoost/clean/cp2k/cp2k/makefiles/../src/dbcsr_lib/dbcsr_blas_operations.F:60: error: undefined reference to 'iseed.2556.979179.13933' collect2: error: ld returned 1 exit status The error is absent if the optimization options used are -flto -O1 instead of -flto -O2. I have not been able to reduce this to a small testcase, so I'll post as simple as possible build instructions in a next comment
Get trunk CP2K and build with lto (note, this requires checking=release, PR45586) and a couple of minutes on a larger machine. svn co svn://svn.code.sf.net/p/cp2k/code/trunk/cp2k cp2k cd cp2k/makefiles/ cat ../arch/lto.sopt # and check all is appropriate (note blas/lapack linking) make -j48 ARCH=lto VERSION=sopt starting a fresh build goes with make -j48 ARCH=lto VERSION=sopt realclean
The failure is absent on the 4.7 branch
GCC 4.8.1 has been released.
GCC 4.8.2 has been released.
Jan, could you look into this LTO failure, or suggest how I can help to get this fixed ? The problem seems to be related to iseed, an argument to dbcsr_lapack_larnv in dbcsr_lib/dbcsr_blas_operations.F. This function is only called from dbcsr_make_random_matrix, where iseed is defined as a local SAVE'd variable. I think that none of the callers of dbcsr_make_random_matrix ends up in the binary, so I expect dbcsr_make_random_matrix is removed by LTO, but somehow the reference to iseed remains, leading to linking errors.
I understand that both the 4.8 branch and trunk fail?
(In reply to Richard Biener from comment #6) > I understand that both the 4.8 branch and trunk fail? Correct.
Waiting for analysis.
(In reply to Richard Biener from comment #8) > Waiting for analysis. Analysis by whom, and if me, what can I do ?
So, after the change from fat to slim lto, I've added the CP2K SVN repo to use gcc-ar (so that the instructions in comment #1 should still work). Now, the issue discussed here fails to reproduce because during the lto phase we run into: /data/vjoost/clean/cp2k/cp2k/makefiles/../src/thermostat_methods.F:102:0: internal compiler error: tree check: expected ssa_name, have integer_cst in simplify_conversion_from_bitmask, at tree-ssa-forwprop.c:1189 SUBROUTINE create_thermostats(thermostats, md_section, force_env, simpar, & ^ 0xb15de4 tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc/gcc/tree.c:9189 0x9e52c0 tree_check ../../gcc/gcc/tree.h:2710 0x9e52c0 simplify_conversion_from_bitmask ../../gcc/gcc/tree-ssa-forwprop.c:1189 0x9ef3cd ssa_forward_propagate_and_combine ../../gcc/gcc/tree-ssa-forwprop.c:3552 0x9ef3cd execute ../../gcc/gcc/tree-ssa-forwprop.c:3661 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. make[2]: *** [/tmp/ccEVGVIu.ltrans20.ltrans.o] Error 1
the ICE just mentioned is PR59154.
Building with 4.9.0 now works, 4.8.3 [gcc-4_8-branch revision 203695] still fails.
The 4.9 problem is gone, not sure which revision fixed this, the only thing I noticed was this comment. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45375#c195 and I have now a couple of LTO builds as part of our daily gcc tester, so I'll notice quickly if it regresses. Not sure if it is worth keeping the bug open for 4.8, I guess there will be other issues popping up with 4.8 anyway.
current 4.8 branch still fails as described in comment #0
GCC 4.8.3 is being released, adjusting target milestone.
GCC 4.8.4 has been released.
Fixed for 4.9.0.