Boost C++ Libraries: Ticket #5284: gcc-4.4.3 compiler warnings with Interprocess+Intrusive https://svn.boost.org/trac10/ticket/5284 <p> I've been using Boost Interprocess managed_shared_memory for a short time. My project was previously using a cross compiler environment based on gcc-4.4.0/glibc-2.3.6 but is moving to gcc-4.4.3/glibc-2.11.1. gcc-4.4.3 with -O2 is started generating compiler warnings in the Intrusive library when I attempt to execute the construct() method on managed_shared_memory object. -O0 and -O1 are still happy. I'm wondering if anyone else has seen similar, has suggestions on debug/fix, or does this appear to be compiler issue? </p> <p> Program snippet: #include "boost/interprocess/managed_shared_memory.hpp" #include &lt;cstdlib&gt; <em>std::system #include &lt;cstddef&gt; </em></p> <p> int main(int argc, char *argv[]) { </p> <blockquote> <p> using namespace boost::interprocess; typedef std::pair&lt;double, int&gt; <a class="missing wiki">MyType</a>; </p> </blockquote> <blockquote> <p> <em>Construct managed shared memory managed_shared_memory segment(create_only, "<a class="missing wiki">MySharedMemory</a>", 65536); </em></p> </blockquote> <blockquote> <p> <em>Create an object of <a class="missing wiki">MyType</a> initialized to {0.0, 0} <a class="missing wiki">MyType</a> *instance = segment.construct&lt;<a class="missing wiki">MyType</a>&gt; </em></p> <blockquote> <p> ("<a class="missing wiki">MyType</a> instance") <em>name of the object (0.0, 0); </em>ctor first argument </p> </blockquote> <p> return 0; </p> </blockquote> <p> } </p> <p> Compiler output: gcc-4.4.3-glibc-2.11.1-grte/x86/bin/g++ -ld -MD -MP -g -O2 -Wall -Werror </p> <blockquote> <p> -fno-omit-frame-pointer -Wno-error -Wno-deprecated -fpic -I/home/mitzel/src/boost_1_46_0 -c -o test.o test.cc </p> </blockquote> <p> In file included from /home/mitzel/src/boost_1_46_0/boost/intrusive/rbtree_algorithms.hpp:58, </p> <blockquote> <p> from /home/mitzel/src/boost_1_46_0/boost/intrusive/detail/rbtree_node.hpp:20, from /home/mitzel/src/boost_1_46_0/boost/intrusive/set_hook.hpp:20, from /home/mitzel/src/boost_1_46_0/boost/intrusive/rbtree.hpp:25, from /home/mitzel/src/boost_1_46_0/boost/intrusive/set.hpp:19, from /home/mitzel/src/boost_1_46_0/boost/interprocess/mem_algo/rbtree_best_fit.hpp:47, from /home/mitzel/src/boost_1_46_0/boost/interprocess/detail/managed_memory_impl.hpp:22, from /home/mitzel/src/boost_1_46_0/boost/interprocess/managed_shared_memory.hpp:21, from test.cc:1: </p> </blockquote> <p> /home/mitzel/src/boost_1_46_0/boost/intrusive/detail/tree_algorithms.hpp: </p> <blockquote> <p> In static member function 'static typename NodeTraits::node_ptr boost::intrusive::detail::tree_algorithms&lt;<a class="missing wiki">NodeTraits</a>&gt;::minimum(typename NodeTraits::node_ptr) [with <a class="missing wiki">NodeTraits</a> = boost::intrusive::rbtree_node_traits&lt;boost::interprocess::offset_ptr&lt;void&gt;, true&gt;]': </p> </blockquote> <p> /home/mitzel/src/boost_1_46_0/boost/intrusive/detail/tree_algorithms.hpp:490: </p> <blockquote> <p> warning: '&lt;anonymous&gt;' may be used uninitialized in this function </p> </blockquote> <p> /home/mitzel/src/boost_1_46_0/boost/intrusive/detail/tree_algorithms.hpp: </p> <blockquote> <p> In static member function 'static typename NodeTraits::node_ptr boost::intrusive::detail::tree_algorithms&lt;<a class="missing wiki">NodeTraits</a>&gt;::maximum(typename NodeTraits::node_ptr) [with <a class="missing wiki">NodeTraits</a> = boost::intrusive::rbtree_node_traits&lt;boost::interprocess::offset_ptr&lt;void&gt;, true&gt;]': </p> </blockquote> <p> /home/mitzel/src/boost_1_46_0/boost/intrusive/detail/tree_algorithms.hpp:507: </p> <blockquote> <p> warning: '&lt;anonymous&gt;' may be used uninitialized in this function </p> </blockquote> <p> /home/mitzel/src/boost_1_46_0/boost/intrusive/detail/utilities.hpp: </p> <blockquote> <p> In static member function 'static void boost::intrusive::detail::tree_algorithms&lt;<a class="missing wiki">NodeTraits</a>&gt;::insert_equal_check_impl( bool, typename NodeTraits::node_ptr, typename NodeTraits::node_ptr, <a class="missing wiki">NodePtrCompare</a>, boost::intrusive::detail::tree_algorithms&lt;<a class="missing wiki">NodeTraits</a>&gt;::insert_commit_data&amp;, size_t*) [with <a class="missing wiki">NodePtrCompare</a> = boost::intrusive::detail::key_nodeptr_comp&lt;std::less&lt; boost::interprocess::rbtree_best_fit&lt;boost::interprocess::mutex_family&gt;::block_ctrl&gt;, boost::intrusive::rbtree_impl&lt;boost::intrusive::setopt&lt;boost::intrusive::detail::base_hook_traits&lt; boost::interprocess::rbtree_best_fit&lt;boost::interprocess::mutex_family&gt;::block_ctrl, boost::intrusive::rbtree_node_traits&lt;boost::interprocess::offset_ptr&lt;void&gt;, true&gt;, (boost::intrusive::link_mode_type)0u, boost::intrusive::default_tag, 3&gt;, std::less&lt;boost::interprocess::rbtree_best_fit&lt;boost::interprocess::mutex_family&gt;::block_ctrl&gt;, long unsigned int, true&gt; &gt; &gt;, <a class="missing wiki">NodeTraits</a> = boost::intrusive::rbtree_node_traits&lt;boost::interprocess::offset_ptr&lt;void&gt;, true&gt;]': </p> </blockquote> <p> /home/mitzel/src/boost_1_46_0/boost/intrusive/detail/utilities.hpp:234: warning: '&lt;anonymous&gt;' may be used uninitialized in this function /home/mitzel/src/boost_1_46_0/boost/intrusive/detail/utilities.hpp:234: note: '&lt;anonymous&gt;' was declared here </p> <p> thanks for your time and any suggestions. danny &lt;mitzel@…&gt; </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5284 Trac 1.4.3 Ion Gaztañaga Fri, 01 Apr 2011 17:23:08 GMT <link>https://svn.boost.org/trac10/ticket/5284#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5284#comment:1</guid> <description> <p> Sorry, I couldn't figure out what's happening, any new information since bug report? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 22 Aug 2012 17:24:12 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5284#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5284#comment:2</guid> <description> <p> I have a similar problem compiling my application with Boost inreprocess under GCC 4.4.6. When I compile using -O3 optimization then it fails with following errors. </p> <p> /boost/intrusive/detail/tree_algorithms.hpp:1617: error: '&lt;anonymous&gt;' may be used uninitialized in this function </p> <p> /boost/intrusive/detail/tree_algorithms.hpp:1617: error: '&lt;anonymous&gt;' may be used uninitialized in this function </p> <p> /boost/boost/intrusive/detail/utilities.hpp:234: error: '&lt;anonymous&gt;' may be used uninitialized in this function </p> <p> /boost/intrusive/detail/utilities.hpp:234: note: '&lt;anonymous&gt;' was declared here </p> <p> /boost/intrusive/detail/utilities.hpp:234: error: '&lt;anonymous&gt;' may be used uninitialized in this function </p> <p> /boost/intrusive/detail/utilities.hpp:234: note: '&lt;anonymous&gt;' was declared here </p> <p> /boost/intrusive/detail/tree_algorithms.hpp:1617: error: '&lt;anonymous&gt;' may be used uninitialized in this function </p> <p> /boost/intrusive/detail/tree_algorithms.hpp:1617: error: '&lt;anonymous&gt;' may be used uninitialized in this function </p> <p> /boost/intrusive/detail/tree_algorithms.hpp:1608: error: '&lt;anonymous&gt;' may be used uninitialized in this function </p> <p> /boost/intrusive/detail/tree_algorithms.hpp:1608: error: '&lt;anonymous&gt;' may be used uninitialized in this function </p> <p> /boost/intrusive/detail/utilities.hpp:234: error: '&lt;anonymous&gt;' may be used uninitialized in this function </p> <p> /boost/intrusive/detail/utilities.hpp:234: note: '&lt;anonymous&gt;' was declared here </p> <p> /boost/intrusive/detail/utilities.hpp:234: error: '&lt;anonymous&gt;' may be used uninitialized in this function </p> <p> /boost/intrusive/detail/utilities.hpp:234: note: '&lt;anonymous&gt;' was declared here </p> <p> /boost/intrusive/detail/tree_algorithms.hpp:1608: error: '&lt;anonymous&gt;' may be used uninitialized in this function </p> <p> /intrusive/detail/tree_algorithms.hpp:1608: error: '&lt;anonymous&gt;' may be used uninitialized in this function </p> <p> This problem only occurs with version of GCC 4.4.6 and compilation is done with -O3. It does not occur if I remove -O3. </p> </description> <category>Ticket</category> </item> </channel> </rss>