Opened 13 years ago

Closed 12 years ago

#3441 closed Bugs (fixed)

boost::pool cast alignment warnings on Sparc

Reported by: Evan Jones <evanj@…> Owned by: Chris Newbold
Milestone: Boost 1.41.0 Component: pool
Version: Boost 1.40.0 Severity: Problem
Keywords: Cc: boostpool@…

Description

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.

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

In file included from boost_1_40_0/boost/pool/object_pool.hpp:15,

from objpooltest.cc:1:

boost_1_40_0/boost/pool/pool.hpp: In member function ‘char*& boost::details::PODptr<SizeType>::next_ptr() const [with SizeType = unsigned int]’: boost_1_40_0/boost/pool/pool.hpp:121: instantiated from ‘boost::details::PODptr<SizeType> boost::details::PODptr<SizeType>::next() const [with SizeType = unsigned int]’ boost_1_40_0/boost/pool/object_pool.hpp:116: instantiated from ‘boost::object_pool<T, UserAllocator>::~object_pool() [with T = int, UserAllocator = 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’ increases required alignment of target type boost_1_40_0/boost/pool/pool.hpp: In member function ‘SizeType& boost::details::PODptr<SizeType>::next_size() const [with SizeType = unsigned int]’: boost_1_40_0/boost/pool/pool.hpp:121: instantiated from ‘boost::details::PODptr<SizeType> boost::details::PODptr<SizeType>::next() const [with SizeType = unsigned int]’ boost_1_40_0/boost/pool/object_pool.hpp:116: instantiated from ‘boost::object_pool<T, UserAllocator>::~object_pool() [with T = int, UserAllocator = 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

Attachments (1)

objpooltest.cc (102 bytes ) - added by Evan Jones <evanj@…> 13 years ago.
Minimal test program objpooltest.cc

Download all attachments as: .zip

Change History (3)

by Evan Jones <evanj@…>, 13 years ago

Attachment: objpooltest.cc added

Minimal test program objpooltest.cc

comment:1 by John Maddock, 12 years ago

Cc: boostpool@… added

comment:2 by John Maddock, 12 years ago

Resolution: fixed
Status: newclosed

This appears to have been fixed already in revision [62705].

Note: See TracTickets for help on using tickets.