Opened 12 years ago

Last modified 10 years ago

#5284 new Bugs

gcc-4.4.3 compiler warnings with Interprocess+Intrusive

Reported by: Danny Mitzel <mitzel@…> Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: intrusive
Version: Boost 1.46.0 Severity: Problem
Keywords: Cc:

Description

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?

Program snippet: #include "boost/interprocess/managed_shared_memory.hpp" #include <cstdlib> std::system #include <cstddef>

int main(int argc, char *argv[]) {

using namespace boost::interprocess; typedef std::pair<double, int> MyType;

Construct managed shared memory managed_shared_memory segment(create_only, "MySharedMemory", 65536);

Create an object of MyType initialized to {0.0, 0} MyType *instance = segment.construct<MyType>

("MyType instance") name of the object (0.0, 0); ctor first argument

return 0;

}

Compiler output: gcc-4.4.3-glibc-2.11.1-grte/x86/bin/g++ -ld -MD -MP -g -O2 -Wall -Werror

-fno-omit-frame-pointer -Wno-error -Wno-deprecated -fpic -I/home/mitzel/src/boost_1_46_0 -c -o test.o test.cc

In file included from /home/mitzel/src/boost_1_46_0/boost/intrusive/rbtree_algorithms.hpp:58,

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:

/home/mitzel/src/boost_1_46_0/boost/intrusive/detail/tree_algorithms.hpp:

In static member function 'static typename NodeTraits::node_ptr boost::intrusive::detail::tree_algorithms<NodeTraits>::minimum(typename NodeTraits::node_ptr) [with NodeTraits = boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>]':

/home/mitzel/src/boost_1_46_0/boost/intrusive/detail/tree_algorithms.hpp:490:

warning: '<anonymous>' may be used uninitialized in this function

/home/mitzel/src/boost_1_46_0/boost/intrusive/detail/tree_algorithms.hpp:

In static member function 'static typename NodeTraits::node_ptr boost::intrusive::detail::tree_algorithms<NodeTraits>::maximum(typename NodeTraits::node_ptr) [with NodeTraits = boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>]':

/home/mitzel/src/boost_1_46_0/boost/intrusive/detail/tree_algorithms.hpp:507:

warning: '<anonymous>' may be used uninitialized in this function

/home/mitzel/src/boost_1_46_0/boost/intrusive/detail/utilities.hpp:

In static member function 'static void boost::intrusive::detail::tree_algorithms<NodeTraits>::insert_equal_check_impl( bool, typename NodeTraits::node_ptr, typename NodeTraits::node_ptr, NodePtrCompare, boost::intrusive::detail::tree_algorithms<NodeTraits>::insert_commit_data&, size_t*) [with NodePtrCompare = boost::intrusive::detail::key_nodeptr_comp<std::less< boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>::block_ctrl>, boost::intrusive::rbtree_impl<boost::intrusive::setopt<boost::intrusive::detail::base_hook_traits< boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>::block_ctrl, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::default_tag, 3>, std::less<boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>::block_ctrl>, long unsigned int, true> > >, NodeTraits = boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>]':

/home/mitzel/src/boost_1_46_0/boost/intrusive/detail/utilities.hpp:234: warning: '<anonymous>' may be used uninitialized in this function /home/mitzel/src/boost_1_46_0/boost/intrusive/detail/utilities.hpp:234: note: '<anonymous>' was declared here

thanks for your time and any suggestions. danny <mitzel@…>

Change History (2)

comment:1 by Ion Gaztañaga, 12 years ago

Sorry, I couldn't figure out what's happening, any new information since bug report?

comment:2 by anonymous, 10 years ago

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.

/boost/intrusive/detail/tree_algorithms.hpp:1617: error: '<anonymous>' may be used uninitialized in this function

/boost/intrusive/detail/tree_algorithms.hpp:1617: error: '<anonymous>' may be used uninitialized in this function

/boost/boost/intrusive/detail/utilities.hpp:234: error: '<anonymous>' may be used uninitialized in this function

/boost/intrusive/detail/utilities.hpp:234: note: '<anonymous>' was declared here

/boost/intrusive/detail/utilities.hpp:234: error: '<anonymous>' may be used uninitialized in this function

/boost/intrusive/detail/utilities.hpp:234: note: '<anonymous>' was declared here

/boost/intrusive/detail/tree_algorithms.hpp:1617: error: '<anonymous>' may be used uninitialized in this function

/boost/intrusive/detail/tree_algorithms.hpp:1617: error: '<anonymous>' may be used uninitialized in this function

/boost/intrusive/detail/tree_algorithms.hpp:1608: error: '<anonymous>' may be used uninitialized in this function

/boost/intrusive/detail/tree_algorithms.hpp:1608: error: '<anonymous>' may be used uninitialized in this function

/boost/intrusive/detail/utilities.hpp:234: error: '<anonymous>' may be used uninitialized in this function

/boost/intrusive/detail/utilities.hpp:234: note: '<anonymous>' was declared here

/boost/intrusive/detail/utilities.hpp:234: error: '<anonymous>' may be used uninitialized in this function

/boost/intrusive/detail/utilities.hpp:234: note: '<anonymous>' was declared here

/boost/intrusive/detail/tree_algorithms.hpp:1608: error: '<anonymous>' may be used uninitialized in this function

/intrusive/detail/tree_algorithms.hpp:1608: error: '<anonymous>' may be used uninitialized in this function

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.

Note: See TracTickets for help on using tickets.