[Boost-bugs] [Boost C++ Libraries] #7512: Boost.Test segmentation fault when built with clang on Mac OS X.

Subject: [Boost-bugs] [Boost C++ Libraries] #7512: Boost.Test segmentation fault when built with clang on Mac OS X.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-10-16 10:23:55


#7512: Boost.Test segmentation fault when built with clang on Mac OS X.
-------------------------------+--------------------------------------------
 Reporter: manphiz@… | Owner: rogeeff
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: test
  Version: Boost 1.51.0 | Severity: Problem
 Keywords: |
-------------------------------+--------------------------------------------
 Mac OS X 10.8.2, Xcode 4.5.1

 $ clang -v
 Apple clang version 4.1 (tags/Apple/clang-421.11.65) (based on LLVM
 3.1svn)
 Target: x86_64-apple-darwin12.2.0
 Thread model: posix

 Boost is built with clang without -std=c++11.

 The problem is shown below:

 {{{
 $ cat boost_test_segfault.cc
 #define BOOST_TEST_MODULE test

 #include <boost/test/included/unit_test.hpp>

 BOOST_AUTO_TEST_CASE( test1 )
 {
     BOOST_CHECK(true);
 }
 $ clang++ -g -Wall -I/opt/homebrew/include boost_test_segfault.cc
 -L/opt/homebrew/lib -lboost_unit_test_framework-mt
 In file included from boost_test_segfault.cc:3:
 In file included from
 /opt/homebrew/include/boost/test/included/unit_test.hpp:20:
 In file included from
 /opt/homebrew/include/boost/test/impl/framework.ipp:29:
 In file included from /opt/homebrew/include/boost/test/test_tools.hpp:21:
 /opt/homebrew/include/boost/test/floating_point_comparison.hpp:251:25:
 warning: unused variable 'check_is_close' [-Wunused-variable]
 check_is_close_t const& check_is_close =
 unit_test::ut_detail::static_constant<check_is_close_t>::value;
                         ^
 /opt/homebrew/include/boost/test/floating_point_comparison.hpp:273:25:
 warning: unused variable 'check_is_small' [-Wunused-variable]
 check_is_small_t const& check_is_small =
 unit_test::ut_detail::static_constant<check_is_small_t>::value;
                         ^
 2 warnings generated.
 $ ./a.out
 Running 1 test case...
 Segmentation fault: 11
 }}}
 A detailed gdb session with "bt full" is attached.

 Also, on a relevant post on stackoverflow
 (http://stackoverflow.com/questions/12695625/boost-test-crashes-on-exit-
 with-clang-4-1-llvm-3-1svn) the user tried with building boost using clang
 with -std=c++11 -stdlib=libc++ and compile the test code with the same
 flag and the executable doesn't crash anymore. But I haven't tested that.
 I also tried to build the test program with llvm g++, but it runs with the
 same error.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7512>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC