libstdc++ versus -Wcast-align

Gerald Pfeifer pfeifer@dbai.tuwien.ac.at
Mon Apr 28 08:40:00 GMT 2003


On i386 platforms everything is fine, but when using -Wcast-align on
sparc-sun-solaris2.9 I get the following (and further) warnings:

  /sw/gcc-current/include/c++/3.4/bits/stl_alloc.h: In static member function `
    static void* std::__pool_alloc<__threads, __inst>::_S_refill(unsigned int)
    [with bool __threads = true, int __inst = 0]':
  /sw/gcc-current/include/c++/3.4/bits/stl_alloc.h:366:   instantiated from `static void* std::__pool_alloc<__threads, __inst>::allocate(unsigned int) [with bool __threads = true, int __inst = 0]'
  /sw/gcc-current/include/c++/3.4/bits/stl_alloc.h:198:   instantiated from `static _Tp* std::__simple_alloc<_Tp, _Alloc>::allocate(unsigned int) [with _Tp = PREDICATE_NAMES::TYPE, _Alloc = std::__pool_alloc<true, 0>]'
  /sw/gcc-current/include/c++/3.4/bits/stl_vector.h:127:   instantiated from `_Tp* std::_Vector_alloc_base<_Tp, _Allocator, true>::_M_allocate(unsigned int) [with _Tp = PREDICATE_NAMES::TYPE, _Allocator = std::allocator<PREDICATE_NAMES::TYPE>]'
  /sw/gcc-current/include/c++/3.4/bits/stl_vector.h:156:   instantiated from `std::_Vector_base<_Tp, _Alloc>::_Vector_base(unsigned int, const typename std::_Vector_alloc_base<_Tp, _Alloc, std::_Alloc_traits<_Tp, _Allocator>::_S_instanceless>::allocator_type&) [with _Tp = PREDICATE_NAMES::TYPE, _Alloc = std::allocator<PREDICATE_NAMES::TYPE>]'
  /sw/gcc-current/include/c++/3.4/bits/stl_vector.h:268:   instantiated from `std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = PREDICATE_NAMES::TYPE, _Alloc = std::allocator<PREDICATE_NAMES::TYPE>]'

  /sw/gcc-current/include/c++/3.4/bits/stl_alloc.h:511: warning: cast from `char*
    ' to `std::__pool_alloc<true, 0>::_Obj*' increases required alignment of
    target type

  /sw/gcc-current/include/c++/3.4/bits/stl_alloc.h:512: warning: cast from `char*
    ' to `std::__pool_alloc<true, 0>::_Obj*' increases required alignment of
    target type

  /sw/gcc-current/include/c++/3.4/bits/stl_alloc.h:516: warning: cast from `char*
    ' to `std::__pool_alloc<true, 0>::_Obj*' increases required alignment of
    target type

Does this mean -Wcast-align is practically unusable for C++ (using
libstdc++) or can/will this be fixed?

Gerald



More information about the Libstdc++ mailing list