libstdc++ versus -Wcast-align

Benjamin Kosnik bkoz@redhat.com
Mon Apr 28 13:44:00 GMT 2003


You can try adding

#pragma GCC system_header

to bits/stl_alloc.h, which might hide this error.

You could try using a different allocator than the default __pool_alloc.

>  /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

The other option would be to properly align allocated memory. 

So

516:
          __next_obj = (_Obj*)((char*)__next_obj + __n);

probably comes from:

456:
          _S_start_free = (char*) __new_alloc::allocate(__bytes_to_get);


You'll need to figure out how to align this.

-benjamin



More information about the Libstdc++ mailing list