Skip to content

Compilation warning with gcc 4.8.5

Compiling the latest swift master branch (i.e., d1b43ed) gives warnings, which by default are treated as error and stop the compilation.

The gcc version:

$> gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
Copyright (C) 2015 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.

The configure command:

../configure --enable-ipo --enable-debug --with-hdf5 --with-fftw --with-parmetis=/home/rtobar/local/parmetis/hyrmine/4.0.3/ --with-gsl=/opt/bldr/local/numerics/gsl/2.5 --with-tbbmalloc --with-hydro=sphenix --with-kernel=wendland-C2 --with-subgrid=EAGLE-XL --with-velociraptor=/home/rtobar/scm/git/swiftsim/build/../../VELOCIraptor-STF/builds/native/src MPI_CC=/opt/bldr/local/distributed/openmpi4/4.0.1/bin/mpicc

And the offending compilations:

[...]
libtool: compile:  mpicc -std=gnu99 -DHAVE_CONFIG_H -I. -I../../src -I.. -I/opt/bldr/local/storage/hdf5/1.10.5/include -I/opt/bldr/local/compression/zlib/1.2.11/include -I/opt/bldr/local/compression/szip/2.1.1/include -I/opt/bldr/local/compression/szip/default/include -I/opt/bldr/local/compression/zlib/default/include -I/usr/include -I/opt/bldr/local/numerics/gsl/2.5/include -fopenmp -DWITH_MPI -I/home/rtobar/local/parmetis/hyrmine/4.0.3//include -g -O0 -flto -gdwarf-2 -fvar-tracking-assignments -O3 -fomit-frame-pointer -malign-double -fstrict-aliasing -ffast-math -funroll-loops -march=core-avx2 -mavx2 -pthread -fopenmp -Wall -Wextra -Wno-unused-parameter -Wshadow -Wstrict-prototypes -MT cooling/COLIBRE/mpi-cooling_tables.lo -MD -MP -MF cooling/COLIBRE/.deps/mpi-cooling_tables.Tpo -c ../../src/cooling/COLIBRE/cooling_tables.c -o cooling/COLIBRE/mpi-cooling_tables.o >/dev/null 2>&1
In file included from ../../src/runner.h:31:0,
                 from ../../src/engine.h:45,
                 from ../../src/active.h:27,
                 from ../../src/runner_doiact_grav.c:26:
../../src/gravity_cache.h: In function ‘gravity_cache_populate’:
../../src/gravity_cache.h:229:0: warning: ignoring #pragma omp simd [-Wunknown-pragmas]
 #pragma omp simd
 ^
../../src/gravity_cache.h: In function ‘gravity_cache_write_back’:
../../src/gravity_cache.h:489:0: warning: ignoring #pragma omp simd [-Wunknown-pragmas]
 #pragma omp simd
 ^
[...]
mv -f cooling/COLIBRE/.deps/mpi-cooling_tables.Tpo cooling/COLIBRE/.deps/mpi-cooling_tables.Plo
../../src/runner_doiact_grav.c: In function ‘runner_dopair_grav_pm_full’:
../../src/runner_doiact_grav.c:886:0: warning: ignoring #pragma omp simd [-Wunknown-pragmas]
 #pragma omp simd
 ^
../../src/runner_doiact_grav.c: In function ‘runner_dopair_grav_pm_truncated’:
../../src/runner_doiact_grav.c:1029:0: warning: ignoring #pragma omp simd [-Wunknown-pragmas]
 #pragma omp simd
 ^
[...]

The first two warnings repeat over and over as they appear on a header file.

As in #698 (closed) I can workaround this by using --enable-compiler-warnings=yes.

I have a local fix based on checking the value of the _OPENMP macro. If you think this is a desirable solution (a different one would be to fully enable/disable OpenMP after checking the OpenMP version in configure.ac) I can submit a pull request with the changes.

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