Re: [Boost-bugs] [Boost C++ Libraries] #4008: Segfault in program_options::parse_command_line when compiled with -fshort-enums

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4008: Segfault in program_options::parse_command_line when compiled with -fshort-enums
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-03-14 17:34:42


#4008: Segfault in program_options::parse_command_line when compiled with -fshort-
enums
----------------------------------------------------------+-----------------
 Reporter: Severin Kacianka <severin@…> | Owner: vladimir_prus
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: program_options
  Version: Boost 1.42.0 | Severity: Showstopper
 Keywords: |
----------------------------------------------------------+-----------------

Comment(by Severin Kacianka <severin@…>):

 Another Addition:
 I compiled gcc 4.4.3 to see if it is a gcc issue, but I still get the
 crashes. Here is the valgrind output for the binary compiler with gcc
 4.4.3:
 {{{
 $ /home/severin/software/gcc/bin/g++ -fshort-enums -g
 -Wl,-R,/home/severin/software/gcc/lib test.cpp -lboost_program_options
 $ valgrind a.out
 ==11870== Memcheck, a memory error detector.
 ==11870== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
 ==11870== Using LibVEX rev 1804, a library for dynamic binary translation.
 ==11870== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
 ==11870== Using valgrind-3.3.0, a dynamic binary instrumentation
 framework.
 ==11870== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
 ==11870== For more details, rerun with: -v
 ==11870==
 ==11870== My PID = 11870, parent PID = 11794. Prog and args are:
 ==11870== a.out
 ==11870==
 --11870-- Warning: DWARF2 CFI reader: unhandled DW_OP_ opcode 0x55
 ==11870== Conditional jump or move depends on uninitialised value(s)
 ==11870== at 0x8050238:
 boost::function1<std::vector<boost::program_options::basic_option<char>,
 std::allocator<boost::program_options::basic_option<char> > >,
 std::vector<std::string, std::allocator<std::string> >&>::clear()
 (function_template.hpp:854)
 ==11870== by 0x804F828:
 boost::function1<std::vector<boost::program_options::basic_option<char>,
 std::allocator<boost::program_options::basic_option<char> > >,
 std::vector<std::string, std::allocator<std::string> >&>::~function1()
 (function_template.hpp:752)
 ==11870== by 0x804EF85:
 boost::program_options::detail::cmdline::~cmdline() (cmdline.hpp:54)
 ==11870== by 0x804EFEC:
 boost::program_options::basic_command_line_parser<char>::~basic_command_line_parser()
 (parsers.hpp:88)
 ==11870== by 0x804F097:
 boost::program_options::basic_parsed_options<char>
 boost::program_options::parse_command_line<char>(int, char**,
 boost::program_options::options_description const&, int,
 boost::function1<std::pair<std::string, std::string>, std::string const&>)
 (parsers.hpp:121)
 ==11870== by 0x804DD3E: main (test.cpp:21)
 ==11870==
 ==11870== Conditional jump or move depends on uninitialised value(s)
 ==11870== at 0x805024A:
 boost::function1<std::vector<boost::program_options::basic_option<char>,
 std::allocator<boost::program_options::basic_option<char> > >,
 std::vector<std::string, std::allocator<std::string> >&>::clear()
 (function_template.hpp:855)
 ==11870== by 0x804F828:
 boost::function1<std::vector<boost::program_options::basic_option<char>,
 std::allocator<boost::program_options::basic_option<char> > >,
 std::vector<std::string, std::allocator<std::string> >&>::~function1()
 (function_template.hpp:752)
 ==11870== by 0x804EF85:
 boost::program_options::detail::cmdline::~cmdline() (cmdline.hpp:54)
 ==11870== by 0x804EFEC:
 boost::program_options::basic_command_line_parser<char>::~basic_command_line_parser()
 (parsers.hpp:88)
 ==11870== by 0x804F097:
 boost::program_options::basic_parsed_options<char>
 boost::program_options::parse_command_line<char>(int, char**,
 boost::program_options::options_description const&, int,
 boost::function1<std::pair<std::string, std::string>, std::string const&>)
 (parsers.hpp:121)
 ==11870== by 0x804DD3E: main (test.cpp:21)
 ==11870==
 ==11870== Use of uninitialised value of size 4
 ==11870== at 0x8050CAB:
 boost::detail::function::basic_vtable1<std::vector<boost::program_options::basic_option<char>,
 std::allocator<boost::program_options::basic_option<char> > >,
 std::vector<std::string, std::allocator<std::string>
>&>::clear(boost::detail::function::function_buffer&)
 (function_template.hpp:503)
 ==11870== by 0x8050268:
 boost::function1<std::vector<boost::program_options::basic_option<char>,
 std::allocator<boost::program_options::basic_option<char> > >,
 std::vector<std::string, std::allocator<std::string> >&>::clear()
 (function_template.hpp:856)
 ==11870== by 0x804F828:
 boost::function1<std::vector<boost::program_options::basic_option<char>,
 std::allocator<boost::program_options::basic_option<char> > >,
 std::vector<std::string, std::allocator<std::string> >&>::~function1()
 (function_template.hpp:752)
 ==11870== by 0x804EF85:
 boost::program_options::detail::cmdline::~cmdline() (cmdline.hpp:54)
 ==11870== by 0x804EFEC:
 boost::program_options::basic_command_line_parser<char>::~basic_command_line_parser()
 (parsers.hpp:88)
 ==11870== by 0x804F097:
 boost::program_options::basic_parsed_options<char>
 boost::program_options::parse_command_line<char>(int, char**,
 boost::program_options::options_description const&, int,
 boost::function1<std::pair<std::string, std::string>, std::string const&>)
 (parsers.hpp:121)
 ==11870== by 0x804DD3E: main (test.cpp:21)
 ==11870==
 ==11870== Use of uninitialised value of size 4
 ==11870== at 0x8050CB4:
 boost::detail::function::basic_vtable1<std::vector<boost::program_options::basic_option<char>,
 std::allocator<boost::program_options::basic_option<char> > >,
 std::vector<std::string, std::allocator<std::string>
>&>::clear(boost::detail::function::function_buffer&)
 (function_template.hpp:504)
 ==11870== by 0x8050268:
 boost::function1<std::vector<boost::program_options::basic_option<char>,
 std::allocator<boost::program_options::basic_option<char> > >,
 std::vector<std::string, std::allocator<std::string> >&>::clear()
 (function_template.hpp:856)
 ==11870== by 0x804F828:
 boost::function1<std::vector<boost::program_options::basic_option<char>,
 std::allocator<boost::program_options::basic_option<char> > >,
 std::vector<std::string, std::allocator<std::string> >&>::~function1()
 (function_template.hpp:752)
 ==11870== by 0x804EF85:
 boost::program_options::detail::cmdline::~cmdline() (cmdline.hpp:54)
 ==11870== by 0x804EFEC:
 boost::program_options::basic_command_line_parser<char>::~basic_command_line_parser()
 (parsers.hpp:88)
 ==11870== by 0x804F097:
 boost::program_options::basic_parsed_options<char>
 boost::program_options::parse_command_line<char>(int, char**,
 boost::program_options::options_description const&, int,
 boost::function1<std::pair<std::string, std::string>, std::string const&>)
 (parsers.hpp:121)
 ==11870== by 0x804DD3E: main (test.cpp:21)
 ==11870==
 ==11870== Jump to the invalid address stated on the next line
 ==11870== at 0x8955C3C9: ???
 ==11870== by 0x8050268:
 boost::function1<std::vector<boost::program_options::basic_option<char>,
 std::allocator<boost::program_options::basic_option<char> > >,
 std::vector<std::string, std::allocator<std::string> >&>::clear()
 (function_template.hpp:856)
 ==11870== by 0x804F828:
 boost::function1<std::vector<boost::program_options::basic_option<char>,
 std::allocator<boost::program_options::basic_option<char> > >,
 std::vector<std::string, std::allocator<std::string> >&>::~function1()
 (function_template.hpp:752)
 ==11870== by 0x804EF85:
 boost::program_options::detail::cmdline::~cmdline() (cmdline.hpp:54)
 ==11870== by 0x804EFEC:
 boost::program_options::basic_command_line_parser<char>::~basic_command_line_parser()
 (parsers.hpp:88)
 ==11870== by 0x804F097:
 boost::program_options::basic_parsed_options<char>
 boost::program_options::parse_command_line<char>(int, char**,
 boost::program_options::options_description const&, int,
 boost::function1<std::pair<std::string, std::string>, std::string const&>)
 (parsers.hpp:121)
 ==11870== by 0x804DD3E: main (test.cpp:21)
 ==11870== Address 0x8955c3c9 is not stack'd, malloc'd or (recently)
 free'd
 ==11870==
 ==11870== Process terminating with default action of signal 11 (SIGSEGV)
 ==11870== Access not within mapped region at address 0x8955C3C9
 ==11870== at 0x8955C3C9: ???
 ==11870== by 0x8050268:
 boost::function1<std::vector<boost::program_options::basic_option<char>,
 std::allocator<boost::program_options::basic_option<char> > >,
 std::vector<std::string, std::allocator<std::string> >&>::clear()
 (function_template.hpp:856)
 ==11870== by 0x804F828:
 boost::function1<std::vector<boost::program_options::basic_option<char>,
 std::allocator<boost::program_options::basic_option<char> > >,
 std::vector<std::string, std::allocator<std::string> >&>::~function1()
 (function_template.hpp:752)
 ==11870== by 0x804EF85:
 boost::program_options::detail::cmdline::~cmdline() (cmdline.hpp:54)
 ==11870== by 0x804EFEC:
 boost::program_options::basic_command_line_parser<char>::~basic_command_line_parser()
 (parsers.hpp:88)
 ==11870== by 0x804F097:
 boost::program_options::basic_parsed_options<char>
 boost::program_options::parse_command_line<char>(int, char**,
 boost::program_options::options_description const&, int,
 boost::function1<std::pair<std::string, std::string>, std::string const&>)
 (parsers.hpp:121)
 ==11870== by 0x804DD3E: main (test.cpp:21)
 ==11870==
 ==11870== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 23 from 1)
 ==11870== malloc/free: in use at exit: 568 bytes in 32 blocks.
 ==11870== malloc/free: 38 allocs, 6 frees, 704 bytes allocated.
 ==11870== For counts of detected errors, rerun with: -v
 ==11870== searching for pointers to 32 not-freed blocks.
 ==11870== checked 123,768 bytes.
 ==11870==
 ==11870== LEAK SUMMARY:
 ==11870== definitely lost: 0 bytes in 0 blocks.
 ==11870== possibly lost: 136 bytes in 6 blocks.
 ==11870== still reachable: 432 bytes in 26 blocks.
 ==11870== suppressed: 0 bytes in 0 blocks.
 ==11870== Rerun with --leak-check=full to see details of leaked memory.
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4008#comment:2>
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:02 UTC