Re: [Boost-bugs] [Boost C++ Libraries] #3950: boost::interprocess::mapped_region destructor deletes shm where it shouldn't.

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3950: boost::interprocess::mapped_region destructor deletes shm where it shouldn't.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-05-21 22:10:57


#3950: boost::interprocess::mapped_region destructor deletes shm where it
shouldn't.
-------------------------------------------+--------------------------------
 Reporter: Lénaïc Huard <lhuard@…> | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: interprocess
  Version: Boost 1.42.0 | Severity: Problem
 Keywords: |
-------------------------------------------+--------------------------------

Comment(by Lénaïc Huard <lhuard@…>):

 I tried to replace all the {{{reinterpret_cast}}} by {{{static_cast}}} but
 it doesn't help to solve the issue.

 According to what I've read [http://stackoverflow.com/questions/1225741
 /performance-impact-of-fno-strict-aliasing here]:

   GCC is fairly aggressive about it: enabling strict aliasing will cause
 it to think that pointers that are "obviously" equivalent to a human (as
 in, foo* a; bar * b; b = (foo*)a;) cannot alias, which allows for some
 very aggressive transformations, but can obviously break non-carefully
 written code.

 If {{{rv}}} references alias to references to other "supposed
 incompatible" types, GCC will assume that operations on the first
 reference cannot affect the object pointed to by the second reference. In
 nearly all cases. Hence the issue.

 The code example of this issue doesn't raise any warning. But the one of
 #3951 raises:

 {{{
 /home/lenaic/doc/prog/boost-
 trunk/boost/interprocess/sync/scoped_lock.hpp:348:
  warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing
 rules
 /home/lenaic/doc/prog/boost-
 trunk/boost/interprocess/sync/scoped_lock.hpp:347:
  warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing
 rules
 /home/lenaic/doc/prog/boost-
 trunk/boost/interprocess/segment_manager.hpp:1334:
  note: initialized from here
 }}}

 And those warnings are well removed by the addition of
 {{{__attribute__((__may_alias__))}}} on {{{rv}}}.

 By the way, in the patch I provided, I'm still wondering why I had to
 touch {{{mapped_region.hpp}}}. But without moving those two methods
 definition to their declaration, I get this unbelievable error:

 {{{
 /home/lenaic/doc/prog/boost-
 trunk/boost/interprocess/mapped_region.hpp:381:
  error: prototype for
 â€˜boost::interprocess::mapped_region::mapped_region(boost::interprocess::rv<boost::interprocess::mapped_region>&)’
 does not match any in class ‘boost::interprocess::mapped_region’
 /home/lenaic/doc/prog/boost-trunk/boost/interprocess/mapped_region.hpp:84:
  error: candidates are:
 boost::interprocess::mapped_region::mapped_region(boost::interprocess::rv<boost::interprocess::mapped_region>&)
 [...]
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3950#comment:4>
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:03 UTC