boost::program_options hangs on the arm "sometimes"

Viewed 751

Currently I am using boost::program_options to parse a configuration file on the BeagleBoard (ARM-based processor). My program is multi-threaded and linked against the boost 1.45 multithreaded libraries.

My program just seems to hang when parsing the configuration file though

namespace po = boost::program_options;
po::options_description desc("Options");
uint32_t option1=0;
std::vector<std::string> optionsString;
std::cout<<"Before adding options"<<std::endl;
desc.add_options()
    ("option1",
     po::value<uint32_t>(&option1), "...")
    ("finaloption",
     po::value<std::vector<std::string> >(&optionsString)->multitoken(), "string of options");
//Never gets here
std::cout<<"After adding options"<<std::endl; 
po::variables_map vm;
std::cout<<"Starting program"<<std::endl;

The program hangs before printing out "After adding options". If I run the program through gdb stop it and do a back trace it just shows that it was on the line before the "Never gets here" comment. The top of the backtrace just has it at

#0 ??
#1 __lll_lock_wait lowlevellock.c:47
#2 __pthread_mutex_lock pthread_mutex_lock.c:61
#3 in boost::shared_ptr<boost::program_options::option_description>* std::__uninitialized_move_a<boost::shared_ptr<boost::program_options::option_description>*, boost::shared_ptr<boost::program_options::option_description>*, std::allocator<boost::shared_ptr<boost::program_option::option_description> > >(boost::shared_ptr<boost::program_optionns::option_description>*, boost::shared_ptr<boost::program_options::option_description>*, std::allocator<boost::shared_ptr<boost::program_options::option_description> >&) () from /usr/local/lib/libboost_program_options-mt.so.1.45.0
#4 in std::vector<boost::shared_ptr<boost::program_options::option_description>, std::allocator<boost::shared_ptr<boost::program_options::option_description> > >::_M_insert_aux(__gnu_cxx::__normal_iterator<boost::shared_ptr<boost::program_options::option_description>, std::vector<boost::shared_ptr<boost::program_options::option_description>, std::allocator<boost::shared_ptr<boost::program_options::option_description> const&)() from /usr/local/lib/libboost_program_options-mt.so.1.45.0
#5 in boost::program_options::options_description::add(boost::shared_ptr<boost::program_options::option_description>) () from /usr/local/lib/libboost_program_options-mt.so.1.45.0

...(let me know if you want more)

Any thoughts? This program works fine on an x86 machine

Edit: Further information, this does not seem to happen with optimizations off (compiled with -O2 this will fairly consistently occur).

Edit2: Further analysis reveals that this still happens with optimizations off, -O0.

1 Answers
Related