oneTBB icon indicating copy to clipboard operation
oneTBB copied to clipboard

2022.2.0: Tests fail to compile

Open Lastique opened this issue 4 months ago • 1 comments

Summary

Building tests fail on Ubuntu 24.04 (gcc 13.3.0) and Debian 12 (gcc 12.2.0).

Version

oneTBB 2022.2.0

Environment

  • Hardware: Core i7 12700K
  • OS and compiler: Ubuntu 24.04 (gcc 13.3.0) and Debian 12 (gcc 12.2.0)

Observed Behavior

Ubuntu 24.04 (gcc 13.3.0) build fails with this error:

[ 61%] Building CXX object test/CMakeFiles/test_openmp.dir/tbb/test_openmp.cpp.o
cd /build/tbb/tbb/obj-x86_64-linux-gnu/test && /usr/bin/c++ -Dtest_openmp_EXPORTS -I/build/tbb/tbb/test/.. -I/build/tbb/tbb/test -I/build/tbb/tbb/src/tbb/../../include -g -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/build/tbb/tbb=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fdebug-prefix-map=/build/tbb/tbb=/usr/src/tbb-2022.2.0-1mind1 -march=nehalem -mtune=icelake-server -Wdate-time -D_FORTIFY_SOURCE=3 -O3 -fno-math-errno -fno-rounding-math -fno-signaling-nans -fno-trapping-math -ftree-vectorize -fgcse-sm -fgcse-las -fgcse-after-reload -ftree-loop-im -funswitch-loops -ftree-loop-if-convert -frename-registers -fivopts --param ssp-buffer-size=32 -fvisibility-inlines-hidden -ftree-loop-distribution -fno-plt -fno-ipa-cp-clone -faligned-new -Wdate-time -D_FORTIFY_SOURCE=3 -O3 -DNDEBUG -std=c++17 -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -Wall -Wextra -Werror -Wfatal-errors -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor -D__TBB_GNU_ASM_VERSION=2042 -mrtm -mwaitpkg -fstack-clash-protection -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong -ffile-prefix-map=/build/tbb/tbb/= -ffile-prefix-map=..//= -MD -MT test/CMakeFiles/test_openmp.dir/tbb/test_openmp.cpp.o -MF CMakeFiles/test_openmp.dir/tbb/test_openmp.cpp.o.d -o CMakeFiles/test_openmp.dir/tbb/test_openmp.cpp.o -c /build/tbb/tbb/test/tbb/test_openmp.cpp
In file included from /usr/include/c++/13/atomic:41,
                 from /build/tbb/tbb/test/common/doctest.h:3223,
                 from /build/tbb/tbb/test/common/test.h:32,
                 from /build/tbb/tbb/test/tbb/test_concurrent_monitor.cpp:26:
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 /usr/include/c++/13/atomic:104:20,
    inlined from 'void tbb::detail::r1::concurrent_monitor_base<Context>::abort_all_relaxed() [with Context = long unsigned int]' at /build/tbb/tbb/test/tbb/../../src/tbb/concurrent_monitor.h:440:53:
/usr/include/c++/13/bits/atomic_base.h:481: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=]
  481 |         __atomic_store_n(&_M_i, __i, int(__m));
      |         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1plus: all warnings being treated as errors
make[3]: *** [test/CMakeFiles/test_concurrent_monitor.dir/build.make:79: test/CMakeFiles/test_concurrent_monitor.dir/tbb/test_concurrent_monitor.cpp.o] Error 1

Full log: tbb_ubuntu2404.txt

Debian 12 (gcc 12.2.0) build fails with this error:

[ 31%] Building CXX object test/CMakeFiles/test_parallel_scan.dir/tbb/test_parallel_scan.cpp.o
cd /build/tbb/tbb/obj-x86_64-linux-gnu/test && /usr/bin/c++ -Dtest_parallel_scan_EXPORTS -I/build/tbb/tbb/test/.. -I/build/tbb/tbb/test -I/build/tbb/tbb/src/tbb/../../include -g -O2 -ffile-prefix-map=/build/tbb/tbb=. -fstack-protector-strong -Wformat -Werror=format-security -march=nehalem -mtune=icelake-server -Wdate-time -D_FORTIFY_SOURCE=2 -O3 -fno-math-errno -fno-rounding-math -fno-signaling-nans -fno-trapping-math -ftree-vectorize -fgcse-sm -fgcse-las -fgcse-after-reload -ftree-loop-im -funswitch-loops -ftree-loop-if-convert -frename-registers -fivopts --param ssp-buffer-size=32 -fvisibility-inlines-hidden -ftree-loop-distribution -fno-plt -fno-ipa-cp-clone -faligned-new -Wdate-time -D_FORTIFY_SOURCE=2 -O3 -DNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -Werror -Wfatal-errors -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor -D__TBB_GNU_ASM_VERSION=2040 -mrtm -mwaitpkg -fstack-clash-protection -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong -ffile-prefix-map=/build/tbb/tbb/= -ffile-prefix-map=..//= -std=c++17 -MD -MT test/CMakeFiles/test_parallel_scan.dir/tbb/test_parallel_scan.cpp.o -MF CMakeFiles/test_parallel_scan.dir/tbb/test_parallel_scan.cpp.o.d -o CMakeFiles/test_parallel_scan.dir/tbb/test_parallel_scan.cpp.o -c /build/tbb/tbb/test/tbb/test_parallel_scan.cpp
In file included from /build/tbb/tbb/test/tbb/test_concurrent_lru_cache.cpp:26:
In destructor 'concurrent_lru_cache_helpers::instance_counter<CounterType>::~instance_counter() [with CounterType = long unsigned int]',
    inlined from 'ValueType& concurrent_lru_cache_helpers::map_searcher<KeyType, ValueType>::operator()(KeyType) [with KeyType = long unsigned int; ValueType = concurrent_lru_cache_helpers::instance_counter<>]' at /build/tbb/tbb/test/common/concurrent_lru_cache_common.h:75:62,
    inlined from 'tbb::detail::d1::concurrent_lru_cache<KeyT, ValT, KeyToValFunctorT>::handle tbb::detail::d1::concurrent_lru_cache<KeyT, ValT, KeyToValFunctorT>::operator[](key_type) [with KeyT = long unsigned int; ValT = concurrent_lru_cache_helpers::instance_counter<>; KeyToValFunctorT = concurrent_lru_cache_helpers::map_searcher<long unsigned int, concurrent_lru_cache_helpers::instance_counter<> >]' at /build/tbb/tbb/src/tbb/../../include/tbb/../oneapi/tbb/concurrent_lru_cache.h:103:60,
    inlined from 'void concurrent_lru_cache_presets::preset_map_instance_count::fill_up_cache(std::size_t, std::size_t)' at /build/tbb/tbb/test/common/concurrent_lru_cache_common.h:244:25,
    inlined from 'void DOCTEST_ANON_FUNC_70()' at /build/tbb/tbb/test/tbb/test_concurrent_lru_cache.cpp:106:32:
/build/tbb/tbb/test/common/concurrent_lru_cache_common.h:118:28: error: pointer used after 'void operator delete(void*, std::size_t)' [-Werror=use-after-free]
  118 |             bool is_last = ! --(*my_p_count);
      |                            ^~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1plus: all warnings being treated as errors
make[3]: *** [test/CMakeFiles/test_concurrent_lru_cache.dir/build.make:79: test/CMakeFiles/test_concurrent_lru_cache.dir/tbb/test_concurrent_lru_cache.cpp.o] Error 1

Full log: tbb_debian12.txt

Expected Behavior

Compilation should not fail.

Steps To Reproduce

See the exact configure and build commands in the attached logs.

Lastique avatar Aug 09 '25 23:08 Lastique

I also just hit this issue using Ubuntu 24.04 LTS, c++ (Ubuntu 13.2.0-23ubuntu4) 13.2.0, on the master branch. It showed up in Release build, and looks to be false positives for the -Werror=stringop-overflow feature of that compiler.

Investigating I saw that cmake/compilers/GNU.cmake had added -Wno-stringop-overflow to avoid this issue, but only for LTO for compiler versions >= 12 and < 15, as that flag was added to TBB_COMMON_LINK_FLAGS This issue can be fixed by simply duplicating that link and changing TBB_COMMON_LINK_FLAGS to TBB_COMMON_COMPILE_FLAGS. IE: set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} $<$<AND:$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},12.0>>,$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},14.0>>:-Wno-stringop-overflow>) in the file cmake/compilers/Clang.cmake

AlexMWells avatar Oct 15 '25 00:10 AlexMWells