PATCH: PR target/38736: [4.4 Regression] -mavx can change the ABI via BIGGEST_ALIGNMENT

Ian Lance Taylor
Wed Jan 7 22:03:00 GMT 2009

Jakub Jelinek <> writes:

> That doesn't reflect what the patch does for i386 (where it doesn't
> set the default alignment to the largest useful alignment, but to the
> 4.3 and older default for compatibility) and I think it would be a very bad
> idea to change it between compiler versions, that would make the aligned
> attribute quite useless.  glibc uses it in its exported headers, so does
> libstdc++ and so does unwind.h.

The aligned attribute is certainly not useless even if it does change
between compiler versions.

We could decide to keep it the same between compiler versions, but
that leaves us in a very awkward position: it makes it hard to write a
generic memory allocator that works for all versions of the processor.
This matters even if you don't use any special types, since
auto-vectorization can introduce them.

You're right, though: libstdc++ does appear to use attribute
((aligned)) in shared_ptr (although I'm not sure it uses it in a way
which changes the ABI).  Of course, if we don't update the alignment,
then we can't use some cases of shared_ptr with a type which requires
a large alignment, which is weird and confusing.

The only use I see in glibc is __pthread_unwind_buf_t, where as far as
I can see it does not affect the ABI (I also don't see why that
structure requires any particular alignment).

Do you have any suggestions for how we should handle this issue?


More information about the Gcc-patches mailing list