Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4452: NDEBUG causes segv in interprocess::managed_mapped_file
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-07-02 16:24:00
#4452: NDEBUG causes segv in interprocess::managed_mapped_file
---------------------------------------------------------+------------------
Reporter: Richard Murphy <richard.murphy@â¦> | Owner: igaztanaga
Type: Bugs | Status: reopened
Milestone: Boost 1.48.0 | Component: interprocess
Version: Boost 1.46.1 | Severity: Problem
Resolution: | Keywords: NDEBUG interprocess segv
---------------------------------------------------------+------------------
Changes (by Lénaïc Huard <lhuard@â¦>):
* status: closed => reopened
* version: Boost 1.43.0 => Boost 1.46.1
* resolution: invalid =>
* milestone: Boost 1.44.0 => Boost 1.48.0
Comment:
I have exactly the same problem with Boost 1.46.1 and even managed to
reproduce it with a smaller program.
Here is the code that reproduces the issue:
{{{
#include <cstdlib>
#include <boost/interprocess/managed_shared_memory.hpp>
int main()
{
boost::interprocess::managed_shared_memory aShm(
boost::interprocess::create_only, "/toto", 4096 );
return EXIT_SUCCESS;
}
}}}
In my case, this piece of code works when compiled with g++ 4.4.
But this program segvs when compiled:
* with g++ 4.5 or g++ 4.6;
* with `-DNDEBUG` (this is really what triggers the bug);
* with optimizations enabled. `-O1` is enough.
I had a look at that and managed to have the above program work with
`g++-4.6 -O1 -DNDEBUG` by one patch on
`intrusive/detail/tree_algorithms.hpp`:
{{{
--- /usr/include/boost/intrusive/detail/tree_algorithms.hpp 2011-06-12
08:15:00.000000000 +0200
+++ boost_patch/include/boost/intrusive/detail/tree_algorithms.hpp
2011-07-02 18:09:02.504756424 +0200
@@ -902,6 +902,7 @@
{
//Check if commit_data has not been initialized by a
insert_unique_check call.
BOOST_INTRUSIVE_INVARIANT_ASSERT(commit_data.node != 0);
+ ((commit_data.node != 0) ? static_cast<void> (0) : abort());
node_ptr parent_node(commit_data.node);
if(parent_node == header){
NodeTraits::set_parent(header, new_node);
}}}
This patch makes the above program works when compiled with `-O1` but is
not enough for higher level of optimizations. With `-O2` and above and the
above patch, the program keeps on segfaulting.
This is obviously not an acceptable patch and I need to better understand
the issue, but I hope this gives a clue.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4452#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:06 UTC