Boost C++ Libraries: Ticket #3441: boost::pool cast alignment warnings on Sparc https://svn.boost.org/trac10/ticket/3441 <p> This may not be fixable, but I generally have been compiling my code on Sparc using GCC's -Wcast-align to catch places where code may attempt to make an unaligned access. When I use boost::object_pool, I get the compiler warnings below. I don't know of any "clean" way to avoid this. I've added a pragma to pool.hpp to suppress the warning when this file is included. </p> <p> System: Solaris 10, Sparc (where alignment matters) Compiler: GCC 4.4.0 Boost: Boost 1.40.0 Command line: gcc -Wcast-align -c objpooltest.cc -Iboost_1_40_0 </p> <p> In file included from boost_1_40_0/boost/pool/object_pool.hpp:15, </p> <blockquote> <p> from objpooltest.cc:1: </p> </blockquote> <p> boost_1_40_0/boost/pool/pool.hpp: In member function ‘char*&amp; boost::details::PODptr&lt;<a class="missing wiki">SizeType</a>&gt;::next_ptr() const [with <a class="missing wiki">SizeType</a> = unsigned int]’: boost_1_40_0/boost/pool/pool.hpp:121: instantiated from ‘boost::details::PODptr&lt;<a class="missing wiki">SizeType</a>&gt; boost::details::PODptr&lt;<a class="missing wiki">SizeType</a>&gt;::next() const [with <a class="missing wiki">SizeType</a> = unsigned int]’ boost_1_40_0/boost/pool/object_pool.hpp:116: instantiated from ‘boost::object_pool&lt;T, <a class="missing wiki">UserAllocator</a>&gt;::~object_pool() [with T = int, <a class="missing wiki">UserAllocator</a> = boost::default_user_allocator_new_delete]’ objpooltest.cc:4: instantiated from here boost_1_40_0/boost/pool/pool.hpp:118: warning: cast from ‘char*’ to ‘char<strong>’ increases required alignment of target type boost_1_40_0/boost/pool/pool.hpp: In member function ‘<a class="missing wiki">SizeType</a>&amp; boost::details::PODptr&lt;<a class="missing wiki">SizeType</a>&gt;::next_size() const [with <a class="missing wiki">SizeType</a> = unsigned int]’: boost_1_40_0/boost/pool/pool.hpp:121: instantiated from ‘boost::details::PODptr&lt;<a class="missing wiki">SizeType</a>&gt; boost::details::PODptr&lt;<a class="missing wiki">SizeType</a>&gt;::next() const [with <a class="missing wiki">SizeType</a> = unsigned int]’ boost_1_40_0/boost/pool/object_pool.hpp:116: instantiated from ‘boost::object_pool&lt;T, <a class="missing wiki">UserAllocator</a>&gt;::~object_pool() [with T = int, <a class="missing wiki">UserAllocator</a> = boost::default_user_allocator_new_delete]’ objpooltest.cc:4: instantiated from here boost_1_40_0/boost/pool/pool.hpp:116: warning: cast from ‘char*’ to ‘unsigned int*’ increases required alignment of target type </strong></p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3441 Trac 1.4.3 Evan Jones <evanj@…> Sat, 12 Sep 2009 16:27:16 GMT attachment set https://svn.boost.org/trac10/ticket/3441 https://svn.boost.org/trac10/ticket/3441 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">objpooltest.cc</span> </li> </ul> <p> Minimal test program objpooltest.cc </p> Ticket John Maddock Fri, 07 Jan 2011 11:23:04 GMT cc set https://svn.boost.org/trac10/ticket/3441#comment:1 https://svn.boost.org/trac10/ticket/3441#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">boostpool@…</span> added </li> </ul> Ticket John Maddock Mon, 14 Feb 2011 18:01:45 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3441#comment:2 https://svn.boost.org/trac10/ticket/3441#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> This appears to have been fixed already in revision <a class="changeset" href="https://svn.boost.org/trac10/changeset/62705" title="Use static_cast instead of reinterpret_cast. Fixes #2941">[62705]</a>. </p> Ticket