Boost logo

Boost :

Subject: [boost] [test] SIGSEGV on simple test when -ansi is set with gcc-4.7.0 on Darwin
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-04-10 06:24:40


Hi,

The following simple test signals SIGSEGV when line ***1 is uncommented.

When I recompile Boost.Test and the tests with same project requirements
(see below) everything is OK. Is this the correct behavior? Should -ansi
be set in a coherent way?

Note. I have no issue mixing -ansi with clang-3.0.

Thanks,
Vicente

P.S. I could attach the complete logs if needed (not so big)

=============================

#include <boost/test/unit_test.hpp>
void test_1() {
   BOOST_CHECK(true);
}
boost::unit_test::test_suite* init_unit_test_suite(int, char*[]) {
     boost::unit_test::test_suite* test =
         BOOST_TEST_SUITE("test suite");
     test->add(BOOST_TEST_CASE(test_1));
     test->add(BOOST_TEST_CASE(test_1));
     test->add(BOOST_TEST_CASE(test_1));
     test->add(BOOST_TEST_CASE(test_1));
     test->add(BOOST_TEST_CASE(test_1));
     //test->add(BOOST_TEST_CASE(test_1)); // *** 1

     return test;
}
=============================

Here it is the log

=============================
darwin.link
../../../bin.v2/libs/thread/test/test_ansi.test/darwin-4.7.0x/debug/test_ansi

     "/usr/local/gcc-4-7-svn/bin/g++" -o
"../../../bin.v2/libs/thread/test/test_ansi.test/darwin-4.7.0x/debug/test_ansi"
"../../../bin.v2/libs/thread/test/test_ansi.test/darwin-4.7.0x/debug/test_ansi.o"
"../../../bin.v2/libs/test/build/darwin-4.7.0x/debug/link-static/libboost_unit_test_framework.a"
-g

testing.capture-output
../../../bin.v2/libs/thread/test/test_ansi.test/darwin-4.7.0x/debug/test_ansi.run

      
"../../../bin.v2/libs/thread/test/test_ansi.test/darwin-4.7.0x/debug/test_ansi"
>
"../../../bin.v2/libs/thread/test/test_ansi.test/darwin-4.7.0x/debug/test_ansi.output"
2>&1
     status=$?
     echo >>
"../../../bin.v2/libs/thread/test/test_ansi.test/darwin-4.7.0x/debug/test_ansi.output"
     echo EXIT STATUS: $status >>
"../../../bin.v2/libs/thread/test/test_ansi.test/darwin-4.7.0x/debug/test_ansi.output"
     if test $status -eq 0 ; then
         cp
"../../../bin.v2/libs/thread/test/test_ansi.test/darwin-4.7.0x/debug/test_ansi.output"
"../../../bin.v2/libs/thread/test/test_ansi.test/darwin-4.7.0x/debug/test_ansi.run"
     fi
     verbose=0
     if test $status -ne 0 ; then
         verbose=1
     fi
     if test $verbose -eq 1 ; then
         echo ====== BEGIN OUTPUT ======
         cat
"../../../bin.v2/libs/thread/test/test_ansi.test/darwin-4.7.0x/debug/test_ansi.output"
         echo ====== END OUTPUT ======
     fi
     exit $status

====== BEGIN OUTPUT ======
Running 6 test cases...
unknown location:0: fatal error in "test_1": signal: SIGSEGV, si_code: 0
(memory access violation at address: 0x00000000)
test_ansi.cpp:5: last checkpoint

*** 1 failure detected in test suite "Master Test Suite"

=============================

Here there are the client project requirements

=============================
project
     : requirements
<warnings>all
<toolset>darwin:<cxxflags>-ansi
     ;


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk