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

--- Comment #6 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
(In reply to r...@cebitec.uni-bielefeld.de from comment #5)
> 
> Unfortunately, this doesn't work: the first time through, _locks[0] was
> already 8-byte aligned and everything worked fine.  This remained when
> using align(8) instead.  However, Mutex is 44 bytes on 32-bit
> Solaris/x86, so again _locks[1] lands on a non-8 byte boundary and
> pthread_mutex_init fails.
> 

Oh, yeah. I didn't consider that size of Mutex would be a problem.


> I tried rouding up the size of the _locks array members to a multiple of
> 8, but that let the constructor already fail the first time through
> where _d_arraycopy checks that the right amount of data is copied:
> 
> _d_arraycopy -> rt.util.array.enforceRawArraysConformable ->
> rt.util.array._enforceSameLength

What you're doing rounding up the array size is correct.  The bit you're
missing is fixing up the slice assignment as well.

lock[0 .. __traits(classInstanceSize, Mutex)] = typeid(Mutex).initializer[];

Reply via email to