oneTBB icon indicating copy to clipboard operation
oneTBB copied to clipboard

test_limiter_node SIGSEGV with forced LTO

Open phprus opened this issue 4 years ago • 8 comments

Commit: 0815661e4c08e4fcaf772d31c1313c63d629a32e

phprus@phprus:~> gcc-7 -v
Using built-in specs.
COLLECT_GCC=gcc-7
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/7/lto-wrapper
OFFLOAD_TARGET_NAMES=hsa:nvptx-none
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,ada,go --enable-offload-targets=hsa,nvptx-none, --without-cuda-driver --enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/7 --enable-ssp --disable-libssp --disable-libvtv --disable-libcc1 --disable-plugin --with-bugurl=https://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function --program-suffix=-7 --without-system-libunwind --enable-multilib --with-arch-32=x86-64 --with-tune=generic --build=x86_64-suse-linux --host=x86_64-suse-linux
Thread model: posix
gcc version 7.5.0 (SUSE Linux) 

Release

CMake:

CC=gcc-7 CXX=g++-7 cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_STANDARD=17 -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON ../..
phprus@phprus:~/devel/oneTBB/oneTBB-0815661e4c08e4fcaf772d31c1313c63d629a32e/build/gcc7-lto> ./gnu_7.5_cxx17_64_release/test_limiter_node
[doctest] doctest version is "2.4.6"
[doctest] run with "--help" for options
===============================================================================
/home/phprus/devel/oneTBB/oneTBB-0815661e4c08e4fcaf772d31c1313c63d629a32e/test/tbb/test_limiter_node.cpp:556:
TEST CASE:  Test continue_msg reception

/home/phprus/devel/oneTBB/oneTBB-0815661e4c08e4fcaf772d31c1313c63d629a32e/test/tbb/test_limiter_node.cpp:556: FATAL ERROR: test case CRASHED: SIGSEGV - Segmentation violation signal

===============================================================================
[doctest] test cases:     2 |     1 passed | 1 failed | 7 skipped
[doctest] assertions: 73888 | 73888 passed | 0 failed |
[doctest] Status: FAILURE!
Ошибка сегментирования (стек памяти сброшен на диск)
phprus@phprus:~/devel/oneTBB/oneTBB-0815661e4c08e4fcaf772d31c1313c63d629a32e/build/gcc7-lto> gdb ./gnu_7.5_cxx17_64_release/test_limiter_node core.test_limiter_no.2507
GNU gdb (GDB; openSUSE Leap 15.2) 10.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./gnu_7.5_cxx17_64_release/test_limiter_node...
[New LWP 2507]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `./gnu_7.5_cxx17_64_release/test_limiter_node'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f0290244013 in _Unwind_Resume () from /lib64/libgcc_s.so.1
Missing separate debuginfos, use: zypper install glibc-debuginfo-2.26-lp152.26.9.1.x86_64 libgcc_s1-debuginfo-10.2.1+git583-lp152.4.1.x86_64 libstdc++6-debuginfo-10.2.1+git583-lp152.4.1.x86_64
(gdb) bt
#0  0x00007f0290244013 in _Unwind_Resume () from /lib64/libgcc_s.so.1
#1  0x0000000000420572 in test_continue_msg_reception() ()
#2  0x0000000000421802 in doctest::Context::run() ()
#3  0x000000000040b96e in main ()
(gdb) 

RelWithDebInfo

CMake:

CC=gcc-7 CXX=g++-7 cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON ../..
phprus@phprus:~/devel/oneTBB/oneTBB-0815661e4c08e4fcaf772d31c1313c63d629a32e/build/gcc7-lto-rwd> ./gnu_7.5_cxx17_64_relwithdebinfo/test_limiter_node
[doctest] doctest version is "2.4.6"
[doctest] run with "--help" for options
===============================================================================
/home/phprus/devel/oneTBB/oneTBB-0815661e4c08e4fcaf772d31c1313c63d629a32e/test/tbb/test_limiter_node.cpp:556:
TEST CASE:  Test continue_msg reception

/home/phprus/devel/oneTBB/oneTBB-0815661e4c08e4fcaf772d31c1313c63d629a32e/test/tbb/test_limiter_node.cpp:556: FATAL ERROR: test case CRASHED: SIGSEGV - Segmentation violation signal

===============================================================================
[doctest] test cases:     2 |     1 passed | 1 failed | 7 skipped
[doctest] assertions: 73888 | 73888 passed | 0 failed |
[doctest] Status: FAILURE!
Ошибка сегментирования (стек памяти сброшен на диск)
phprus@phprus:~/devel/oneTBB/oneTBB-0815661e4c08e4fcaf772d31c1313c63d629a32e/build/gcc7-lto-rwd> gdb ./gnu_7.5_cxx17_64_relwithdebinfo/test_limiter_node core.test_limiter_no.12757
GNU gdb (GDB; openSUSE Leap 15.2) 10.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./gnu_7.5_cxx17_64_relwithdebinfo/test_limiter_node...
[New LWP 12757]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `./gnu_7.5_cxx17_64_relwithdebinfo/test_limiter_node'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fe4dad2a013 in _Unwind_Resume () from /lib64/libgcc_s.so.1
Missing separate debuginfos, use: zypper install glibc-debuginfo-2.26-lp152.26.9.1.x86_64 libgcc_s1-debuginfo-10.2.1+git583-lp152.4.1.x86_64 libstdc++6-debuginfo-10.2.1+git583-lp152.4.1.x86_64
(gdb) bt
#0  0x00007fe4dad2a013 in _Unwind_Resume () from /lib64/libgcc_s.so.1
#1  0x00000000004219e2 in test_continue_msg_reception () at /home/phprus/devel/oneTBB/oneTBB-0815661e4c08e4fcaf772d31c1313c63d629a32e/test/tbb/test_limiter_node.cpp:316
#2  0x00000000004219f9 in _DOCTEST_ANON_FUNC_96() [clone .lto_priv.89] () at /home/phprus/devel/oneTBB/oneTBB-0815661e4c08e4fcaf772d31c1313c63d629a32e/test/tbb/test_limiter_node.cpp:557
#3  0x0000000000419022 in doctest::Context::run (this=this@entry=0x7ffddc1fb908) at /home/phprus/devel/oneTBB/oneTBB-0815661e4c08e4fcaf772d31c1313c63d629a32e/test/common/doctest.h:6586
#4  0x000000000040b8be in main (argc=<optimized out>, argv=<optimized out>) at /home/phprus/devel/oneTBB/oneTBB-0815661e4c08e4fcaf772d31c1313c63d629a32e/test/common/doctest.h:6671
(gdb) 

gcc-8,9,10 - without errors.

phprus avatar Dec 15 '21 09:12 phprus

@phprus is it correct that latest master (https://github.com/oneapi-src/oneTBB/commit/0815661e4c08e4fcaf772d31c1313c63d629a32e) is used ?

anton-potapov avatar Dec 15 '21 14:12 anton-potapov

@anton-potapov Yes. Segfault is present ​only is LTO enabled for tests and only on GCC-7.

In the discussion of PR #647, I did not check build with LTO enabled.

phprus avatar Dec 15 '21 15:12 phprus

@vlserov could you please take a look ?

anton-potapov avatar Dec 15 '21 15:12 anton-potapov

Microsoft Visual Studio 2017, 2019, x86 and x64 - all test passed.

phprus avatar Dec 16 '21 18:12 phprus

@phprus, issue is not related to #647. Tried to use TBB_ENABLE_IPO=ON instead of CMAKE_INTERPROCEDURAL_OPTIMIZATION=ON, all test are passed. CMAKE_INTERPROCEDURAL_OPTIMIZATION adds IPO flags to tests as well.

vlserov avatar Dec 17 '21 08:12 vlserov

@vlserov, Yes, segfault is present only if IPO is enabled for tests.

phprus avatar Dec 17 '21 08:12 phprus

Tested on v2021.3 release with LTO Enable patch, issue is present. Issue appears with GCC 7.5 and flags "-O1 -fdevirtualize -fipa-cp", and it doesn't with only "-O1" flag. It isn't reproduced with GCC 8.1. Possible, some optimization options are conflicted with LTO.

vlserov avatar Dec 23 '21 16:12 vlserov

Maybe close the issue, since the error is not reproduced on gcc-8 and newer?

phprus avatar Mar 05 '22 08:03 phprus

Closing since the error is not reproduced on gcc-8 and newer.

isaevil avatar Oct 05 '22 14:10 isaevil