Opened 13 years ago

Last modified 13 years ago

#29394 closed defect

in boost 1.46.1 program_options lib is unusable in macports — at Initial Version

Reported by: christophe.prudhomme@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 1.9.2
Keywords: boost1.46 program_options Cc:
Port: boost

Description

the following simple program using boost.program_options crashes with the boost macports

#include <iostream>

#include <boost/program_options.hpp> namespace po = boost::program_options; int main(int ac, char av) {

using namespace std;

locale::global(locale("")); Declare the supported options. po::options_description desc("Allowed options"); desc.add_options()

("help", "produce help message") ("compression", po::value<int>(), "set compression level")

;

po::variables_map vm; po::store(po::parse_command_line(ac, av, desc), vm); po::notify(vm);

if (vm.count("help")) {

cout << desc << "\n";

return 1;

}

if (vm.count("compression")) {

cout << "Compression level was set to "

<< vmcompression?.as<int>() << ".\n";

} else {

cout << "Compression level was not set.\n";

} }

the problem lies in printing the options_description structure

(gdb) r --help Starting program: /private/tmp/t --help Allowed options: t(40384) malloc: * error for object 0x7fff70a22500: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug

Program received signal SIGABRT, Aborted. 0x00007fff88cab5d6 in kill () (gdb) bt #0 0x00007fff88cab5d6 in kill () #1 0x00007fff88d4bcd6 in abort () #2 0x00007fff88c636b5 in free () #3 0x00000001001299d0 in std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::overflow () #4 0x000000010012e13c in std::basic_streambuf<char, std::char_traits<char> >::xsputn () #5 0x00007fff84fcdae4 in std::ostream_write<char, std::char_traits<char> > () #6 0x00007fff84fcbb98 in std::ostream_insert<char, std::char_traits<char> > () #7 0x0000000100063b3d in boost::program_options::options_description::print () #8 0x00000001000640b7 in boost::program_options::operator<< () #9 0x00000001000016cf in main ()

Change History (1)

Changed 13 years ago by christophe.prudhomme@…

Attachment: t.cpp added

test program to reproduce the crash

Note: See TracTickets for help on using tickets.