https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79671

--- Comment #75 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 28 Mar 2017, bernd.edlinger at hotmail dot de wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79671
> 
> --- Comment #74 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
> (In reply to rguent...@suse.de from comment #73)
> > 
> > Ah, I remember seeing this.  So this introduces object size as a way
> > to allow some TBAA to happen.  Specifically it forbids creating
> > a series of float sub-objects inside a char[sizeof(float)*4] sub-object
> > due to "there is no smaller array object that satisfies these 
> > constraints"(?).  One would need to use sth like
> > 
> >   struct { unsigned char storage[sizeof(float)]; } st[4];
> > 
> 
> I think that is meant differently, but I am not sure if I
> understand this kind of english good enough..., the sample uses:
> 
> template<typename ...T>
> struct AlignedUnion {
>   alignas(T...) unsigned char data[max(sizeof(T)...)];
> };
> 
> so that data array is max of sizeof(int) and sizeof(char)
> 
> ... the more they write the less clear it becomes :)

I was thinking about how to arrange for _multiple_ objects to
be constructed inside a memory area, the interesting size clause
seems to require workarounds like above.  Otherwise the "array element"
choice doesn't make much sense I guess.

Reply via email to