Opened 11 years ago

Closed 10 years ago

#5682 closed Bugs (invalid)

BOOST_TEST_REPORT_LEVEL and BOOST_TEST_LOG_LEVEL crash on Mac OS X with g++ 4.6.1

Reported by: Thomas Krennwallner <tkren@…> Owned by: Gennadiy Rozental
Milestone: To Be Determined Component: test
Version: Boost 1.46.1 Severity: Regression
Keywords: Cc:

Description

Using the environment setting BOOST_TEST_REPORT_LEVEL=detailed and BOOST_TEST_LOG_LEVEL=all frees an unallocated pointer on mac os x when running simple boost unit tests compiled with g++ 4.6.1; standard g++ 4.2.1 has not this problem:

$ g++ -DBOOST_TEST_DYN_LINK -I/opt/local/include -L/opt/local/lib -lboost_unit_test_framework-mt boost_test.cxx 
$ ./a.out
Running 1 test case...

*** No errors detected
$ BOOST_TEST_REPORT_LEVEL=detailed BOOST_TEST_LOG_LEVEL=all ./a.out
Running 1 test case...
Entering test suite "boost_test"
Entering test case "mytest"
boost_test.cxx:4: info: check true passed
Leaving test case "mytest"; testing time: 40mks
Leaving test suite "boost_test"

Test suite "boost_test" passed with:
  1 assertion out of 1 passed
  1 test case out of 1 passed

  Test case "mytest" passed with:
    1 assertion out of 1 passed

Compiling with g++ 4.6.1 gives

$ g++-mp-4.6 -DBOOST_TEST_DYN_LINK -I/opt/local/include -L/opt/local/lib -lboost_unit_test_framework-mt boost_test.cxx 
$ ./a.out
Running 1 test case...

*** No errors detected
$ BOOST_TEST_REPORT_LEVEL=detailed BOOST_TEST_LOG_LEVEL=all ./a.out
a.out(46920) malloc: *** error for object 0x7fff71199500: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap

A backtrace does not give too much information:

$ BOOST_TEST_REPORT_LEVEL=detailed BOOST_TEST_LOG_LEVEL=all gdb ./a.out
[...]
(gdb) break malloc_error_break
Breakpoint 1 at 0x4189374bb83499
(gdb) run
Starting program: /Users/tkren/a.out 
Reading symbols for shared libraries ++++.. done
a.out(73567) malloc: *** error for object 0x7fff71199500: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

Breakpoint 1, 0x00007fff870a5499 in malloc_error_break ()
(gdb) backtrace
#0  0x00007fff870a5499 in malloc_error_break ()
#1  0x00007fff86fcf183 in free ()
#2  0x000000010019c261 in std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::overflow ()

Attachments (1)

boost_test.cxx (128 bytes ) - added by Thomas Krennwallner <tkren@…> 11 years ago.
BOOST_TEST_REPORT_LEVEL bug on mac os x

Download all attachments as: .zip

Change History (5)

by Thomas Krennwallner <tkren@…>, 11 years ago

Attachment: boost_test.cxx added

BOOST_TEST_REPORT_LEVEL bug on mac os x

comment:1 by Thomas Krennwallner <tkren@…>, 11 years ago

Summary: BOOST_TEST_REPORT_LEVEL and BOOST_TEST_LOG_LEVEL crash on Mac OS X with g++ 4.6.1.1BOOST_TEST_REPORT_LEVEL and BOOST_TEST_LOG_LEVEL crash on Mac OS X with g++ 4.6.1

comment:2 by Gennadiy Rozental, 11 years ago

I do not have access to MacOS. Works fine with gcc 4.6.1 under Ubuntu. backtrace points to the system iostreams. I will not be able to move any further without more information, but I doubt frankly this is Boost.Test issue.

comment:3 by anonymous, 10 years ago

Having the same problem with 4.7

comment:4 by Gennadiy Rozental, 10 years ago

Resolution: invalid
Status: newclosed

I do not have an access to Macs and it works fine both in regression tests and on Linux with similar setup. I do not see any indication yet this is Boost.Test issue. Once you have patch or more concrete pointer to the error in a code please resubmit the issue

Note: See TracTickets for help on using tickets.