Opened 15 years ago
Closed 15 years ago
#967 closed Bugs (invalid)
[program_options] crash on release builds on windows using msvc-8.0 and msvc-8.0_64
| Reported by: | Christopher Lux | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | None | |
| Version: | Boost 1.34.0 | Severity: | Showstopper |
| Keywords: | program_options, msvc | Cc: |
Description
i compiled boost for windows using the msvc-8.0 and msvc-8.0_64 targets. the following code works perfectly on debug builds but crashes on the marked line in x64 mode and goes into an infinite loop in x86 mode. i used visual studio 2005 with and without service pack 1 and even tried the head version of boost from cvs. everytime the crash occurs.
#include <iostream>
#include <boost/program_options.hpp>
namespace po = boost::program_options;
int main(int argc, char **argv)
{
int width;
int height;
try {
po::options_description cmd_options("program options");
cmd_options.add_options()
("help", "show this help message")
("width", po::value<int>(&width)->default_value(1024), "output width")
("height", po::value<int>(&height)->default_value(640), "output height");
po::variables_map command_line;
// the next line produces the crash
po::store(po::parse_command_line(argc, argv, cmd_options), command_line);
po::notify(command_line);
if (command_line.count("help")) {
std::cout << "usage: " << std::endl;
std::cout << cmd_options;
return (0);
}
}
catch (std::exception& e) {
std::cout << e.what() << std::endl;
return (-1);
}
return (0);
}
Change History (3)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
This ticket can be closed. The issue was that boost was compiles with all default compiler settings but the application using program options defined _SECURE_SCL=0 for the release builds. Building boost also with this defined everything workes as expected.
comment:3 by , 15 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |

i found the problem (well rediscovered it): http://lists.boost.org/boost-users/2006/05/19342.php
when disabling _SECURE_SCL on VS8.0 store crashes.
i hope this can be fixed somehow...