Subject: [Boost-bugs] [Boost C++ Libraries] #3363: linking 2 files compiled with different NDEBUG causes segfault
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-08-25 05:00:33
#3363: linking 2 files compiled with different NDEBUG causes segfault
----------------------------+-----------------------------------------------
Reporter: smr@⦠| Owner: az_sw_dude
Type: Bugs | Status: new
Milestone: Boost 1.40.0 | Component: date_time
Version: Boost 1.39.0 | Severity: Problem
Keywords: |
----------------------------+-----------------------------------------------
Linking y1.o and y2.o compiled as below causes the resulting executable to
segfault and show valgrind errors.
x1.o defines NDEBUG before including a boost header, x2.o doesn't.
If both define NDEBUG, or both don't then linking them produces an
executable that runs, and shows no valgrind errors.
This is y1.cpp:
#define NDEBUG 1
#include <boost/date_time/posix_time/posix_time.hpp>
#include <iostream>
void foobar() {
boost::posix_time::time_duration td(0, 0, 1, 0);
std::stringstream ss;
ss << td;
}
void bar(void);
int main()
{
bar();
return 0;
}
This is y2.cpp:
#include <boost/date_time/posix_time/posix_time.hpp>
void bar(void) {
std::cerr<<boost::posix_time::second_clock::local_time()<<' ';
}
Fails:
$ g++ y1.cpp y2.cpp && ./a.out
Segmentation fault
Reported by Debian user; see http://bugs.debian.org/cgi-
bin/bugreport.cgi?bug=537680 for valgrind output.
I have reproduced this behaviour on today's trunk, so I expect it is still
a problem in 1.39.0 and upcoming 1.40.0.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3363> 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:01 UTC