[cfe-dev] libc++ std::cout alignment trouble (was: Re: [llvm] r240144 - [SLP] Vectorize for all-constant entries.)

Tim Northover via cfe-dev cfe-dev at lists.llvm.org
Wed Oct 14 13:48:14 PDT 2015


> cout will *not* be aligned to 16 bytes, whereas the sample I posted
> earlier, and the code in iostream.cpp, *will* be aligned to 16 bytes,
> even though the actual declarations look quite the same.

It's particular operations on the variable that trigger the bump,
rather than just the declaration itself.

> So there is something going on in llvm that bumps up the alignment, for
> some reason, related to r240144.  I would like to either revert that
> behavior, or try to find a way to work around it (except from reverting
> r240144, that is).

Reverting that revision would just be hiding the underlying issue;
completely the wrong thing to do on trunk.

> P.S.: In hindsight, specifying an explicit alignment for std::cout etc
> was maybe not so handy.  But it's too late to change now, without
> breaking the libc++ ABI...

It's impossible to do otherwise (and maintain our cunning lazy
initialization). Other places are using std::cout as an ostream, which
has an ABI-required alignment of (at least) 8.

Cheers.

Tim.



More information about the cfe-dev mailing list