Skip to content

Compilation warning with gcc 9.3.0

When compiling the current master branch of swift (i.e., d1b43ed1c) with gcc 9.3.0 and IPO I get a warning (which is treated like an error by default).

This is the configuration:

$> mkdir build
$> cd build
$> ../configure \
    --enable-ipo \
    --enable-debug \
    --with-hdf5 \
    --with-fftw \
    --with-parmetis \
    --with-gsl \
    --with-tbbmalloc \
    --with-hydro=sphenix \
    --with-kernel=wendland-C2 \
    --with-subgrid=EAGLE-XL \
    --with-velociraptor=`pwd`/../../VELOCIraptor-STF/builds/swift-build/src

Here is gcc:

$> gcc --version
gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

And the unsuccessful compilation:

$> make all -j4
[...]
Making all in examples
make[2]: Entering directory '/home/rtobar/scm/git/swiftsim/build/examples'
/bin/bash ../libtool  --tag=CC   --mode=link mpicc  -I../../src -I../../argparse -I/usr/include -I/usr/include/hdf5/serial     -fopenmp -DWITH_MPI   -DENGINE_POLICY="engine_policy_keep | engine_policy_setaffinity" -g -O0  -flto -gdwarf -fvar-tracking-assignments -O3 -fomit-frame-pointer -malign-double -fstrict-aliasing -ffast-math -funroll-loops -march=broadwell -mavx2 -pthread -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -fopenmp -Wall -Wextra -Wno-unused-parameter -Wshadow -Werror -Wstrict-prototypes -L/usr/lib/x86_64-linux-gnu/hdf5/serial -flto   -lm  -o swift_mpi swift_mpi-main.o ../src/.libs/libswiftsim_mpi.a ../argparse/.libs/libargparse.a -lparmetis   -lhdf5_hl -lhdf5  -lpthread -lsz -lz -ldl -lm -lfftw3_threads -lfftw3 -lnuma    -ltbbmalloc_proxy -ltbbmalloc  -L/home/rtobar/scm/git/swiftsim/build/../../VELOCIraptor-STF/builds/swift-build/src -lvelociraptor -lmpi -lstdc++ -lhdf5 -lgsl -lgslcblas -lm 
/bin/bash ../libtool  --tag=CC   --mode=link mpicc  -I../../src -I../../argparse -I/usr/include -I/usr/include/hdf5/serial     -fopenmp -DENGINE_POLICY="engine_policy_keep | engine_policy_setaffinity" -g -O0  -flto -gdwarf -fvar-tracking-assignments -O3 -fomit-frame-pointer -malign-double -fstrict-aliasing -ffast-math -funroll-loops -march=broadwell -mavx2 -pthread -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -fopenmp -Wall -Wextra -Wno-unused-parameter -Wshadow -Werror -Wstrict-prototypes -L/usr/lib/x86_64-linux-gnu/hdf5/serial -flto   -lm  -o swift swift-main.o ../src/.libs/libswiftsim.a ../argparse/.libs/libargparse.a -lhdf5_hl -lhdf5  -lpthread -lsz -lz -ldl -lm -lfftw3_threads -lfftw3 -lnuma    -ltbbmalloc_proxy -ltbbmalloc  -L/home/rtobar/scm/git/swiftsim/build/../../VELOCIraptor-STF/builds/swift-build/src -lvelociraptor -lmpi -lstdc++ -lhdf5 -lgsl -lgslcblas -lm 
libtool: link: mpicc -I../../src -I../../argparse -I/usr/include -I/usr/include/hdf5/serial -fopenmp -DWITH_MPI "-DENGINE_POLICY=engine_policy_keep | engine_policy_setaffinity" -g -O0 -flto -gdwarf -fvar-tracking-assignments -O3 -fomit-frame-pointer -malign-double -fstrict-aliasing -ffast-math -funroll-loops -march=broadwell -mavx2 -pthread -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -fopenmp -Wall -Wextra -Wno-unused-parameter -Wshadow -Werror -Wstrict-prototypes -flto -o swift_mpi swift_mpi-main.o  -L/usr/lib/x86_64-linux-gnu/hdf5/serial ../src/.libs/libswiftsim_mpi.a ../argparse/.libs/libargparse.a -lparmetis -lhdf5_hl -lpthread -lsz -lz -ldl -lfftw3_threads -lfftw3 -lnuma -ltbbmalloc_proxy -ltbbmalloc -L/home/rtobar/scm/git/swiftsim/build/../../VELOCIraptor-STF/builds/swift-build/src -lvelociraptor -lmpi -lstdc++ -lhdf5 -lgsl -lgslcblas -lm -pthread -fopenmp
libtool: link: mpicc -I../../src -I../../argparse -I/usr/include -I/usr/include/hdf5/serial -fopenmp "-DENGINE_POLICY=engine_policy_keep | engine_policy_setaffinity" -g -O0 -flto -gdwarf -fvar-tracking-assignments -O3 -fomit-frame-pointer -malign-double -fstrict-aliasing -ffast-math -funroll-loops -march=broadwell -mavx2 -pthread -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -fopenmp -Wall -Wextra -Wno-unused-parameter -Wshadow -Werror -Wstrict-prototypes -flto -o swift swift-main.o  -L/usr/lib/x86_64-linux-gnu/hdf5/serial ../src/.libs/libswiftsim.a ../argparse/.libs/libargparse.a -lhdf5_hl -lpthread -lsz -lz -ldl -lfftw3_threads -lfftw3 -lnuma -ltbbmalloc_proxy -ltbbmalloc -L/home/rtobar/scm/git/swiftsim/build/../../VELOCIraptor-STF/builds/swift-build/src -lvelociraptor -lmpi -lstdc++ -lhdf5 -lgsl -lgslcblas -lm -pthread -fopenmp
../../src/fof.c: In function 'fof_search_tree.constprop':
../../src/fof.c:1622:3: error: 'MEM[(void *)&hashmap_mass_send]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1622 |   MPI_Alltoallv(fof_mass_send, sendcount, sendoffset, fof_final_mass_type,
      |   ^
../../src/fof.c:1572:32: note: 'MEM[(void *)&hashmap_mass_send]' was declared here
 1572 |   struct fof_mass_send_hashmap hashmap_mass_send;
      |                                ^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/gcc returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:780: swift_mpi] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/home/rtobar/scm/git/swiftsim/build/examples'
make[1]: *** [Makefile:521: all-recursive] Error 1
make[1]: Leaving directory '/home/rtobar/scm/git/swiftsim/build'
make: *** [Makefile:453: all] Error 2

If I configure with --enable-compiler-warnings=yes I can of course workaround this.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information