oneTBB
oneTBB copied to clipboard
build failure with gcc13: -Werror=stringop-overflow
GCC Version: gcc (GCC) 13.0.0 20220529 (experimental)
steps to reproduce:
# build gcc with git@master
cd / && git clone --depth 1 --single-branch --branch master https://github.com/gcc-mirror/gcc.git
GMP_VERSION="6.2.1" MPFR_VERSION="4.1.0" MPC_VERSION="1.2.1" \
&& cd /tmp && wget https://ftp.gnu.org/gnu/gmp/gmp-${GMP_VERSION}.tar.xz\
&& cd /tmp && wget https://ftp.gnu.org/gnu/mpfr/mpfr-${MPFR_VERSION}.zip \
&& cd /tmp && wget https://ftp.gnu.org/gnu/mpc/mpc-$MPC_VERSION.tar.gz \
&& cd /tmp && tar -xf gmp-$GMP_VERSION.tar.xz && cp -r gmp-$GMP_VERSION/ /gcc/gmp \
&& cd /tmp && unzip mpfr-$MPFR_VERSION.zip && cp -r mpfr-$MPFR_VERSION/ /gcc/mpfr \
&& cd /tmp && tar -xf mpc-$MPC_VERSION.tar.gz && cp -r mpc-$MPC_VERSION/ /gcc/mpc \
&& mkdir /gcc12 && rm -rf /tmp/*
cd /gcc \
&& CXX_FLAGS="-O3 -march=native" ./configure --disable-multilib --prefix=/gcc12 --with-arch=native --disable-werror
cd /gcc \
&& CXX_FLAGS="-O3 -march=native" make -j16 \
&& make install \
&& rm -rf /gcc
export CC=/gcc12/bin/gcc
export LD_LIBRARY_PATH=/gcc12/lib64:$LD_LIBRARY_PATH
export PATH=/gcc12/bin:$PATH
export PKG_CONFIG_PATH=/gcc12/lib64/pkgconfig:$PKG_CONFIG_PATH
# build tbb with that gcc:
cd /tmp && wget https://github.com/oneapi-src/oneTBB/archive/refs/heads/master.zip && unzip master.zip \
&& cd oneTBB-master && cmake -B build . -DCMAKE_BUILD_TYPE=Release \
&& CFLAGS="-O3 -march=native" CXXFLAGS="-O3 -march-native" make -j16 && make install
error log :
[ 1%] Building CXX object src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.o
In file included from /gcc12/include/c++/13.0.0/atomic:41,
from /tmp/oneTBB-master/src/tbb/../../include/oneapi/tbb/detail/_utils.h:22,
from /tmp/oneTBB-master/src/tbb/address_waiter.cpp:17:
In member function 'void std::__atomic_base<_IntTp>::store(__int_type, std::memory_order) [with _ITp = bool]',
inlined from 'void std::atomic<bool>::store(bool, std::memory_order)' at /gcc12/include/c++/13.0.0/atomic:104:20,
inlined from 'void tbb::detail::r1::concurrent_monitor_base<Context>::abort_all_relaxed() [with Context = tbb::detail::r1::address_context]' at /tmp/oneTBB-master/src/tbb/concurrent_monitor.h:430:53,
inlined from 'void tbb::detail::r1::concurrent_monitor_base<Context>::abort_all() [with Context = tbb::detail::r1::address_context]' at /tmp/oneTBB-master/src/tbb/concurrent_monitor.h:413:26,
inlined from 'void tbb::detail::r1::concurrent_monitor_base<Context>::destroy() [with Context = tbb::detail::r1::address_context]' at /tmp/oneTBB-master/src/tbb/concurrent_monitor.h:446:24,
inlined from 'void tbb::detail::r1::clear_address_waiter_table()' at /tmp/oneTBB-master/src/tbb/address_waiter.cpp:60:40:
/gcc12/include/c++/13.0.0/bits/atomic_base.h:480:25: error: 'void __atomic_store_1(volatile void*, unsigned char, int)' writing 1 byte into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
480 | __atomic_store_n(&_M_i, __i, int(__m));
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
gcc13 is not currently part of the support matrix for oneTBB. We will support gcc13 in the future and provide a fix at the time. For now, you can disable the -Wstringop-overflow warning by adding -Wno-error=stringop-overflow to the TBB_WARNING_LEVEL variable in the corresponding cmake file. This file is located at <tbb_sources>/cmake/compilers/GNU.cmake.
See #823 for additional warnings you might need to suppress for now.
I find a issue of GCC which may relate to this problem. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106297
@nanoric The fix was implemented recently - https://github.com/oneapi-src/oneTBB/pull/1192. Please, verify and close the issue if resolved.