possible structure layout bug

Jie Zhang zhangjie@magima.com.cn
Thu Jun 10 10:02:00 GMT 2004


Jie Zhang wrote:

I made a stupid mistake in my last email. When I calculated the 
alignment, I didn't take __attribute__((aligned(16))) into account by an 
  oversight. So I think gcc-3.5.0-20040606 gives the correct result.

> 
> gcc-3.5.0-20040606 gives different result, which seems consistent. 
> However, IMHO it is also wrong:
> 
> __m128 size 16, align 16
> Quad   size 16, align 16
> Base1 32 Derived1 48 Offset 32
> Base2 32 Derived2 48 Offset 32
> Base3 64 Derived3 80 Offset 64
> 
> According to the 386 ABI and C++ ABI used in gcc, I expect the result be
> 
> __m128 size 16, align 16
> Quad   size 16, align 4
> Base1 20 Derived1 24 Offset 20
> Base2 32 Derived2 48 Offset 32
> Base3 64 Derived3 80 Offset 64
> 
> Why does gcc set the alignment of Quad to 16 instead of 4?
> 


-- 
Jie



More information about the Gcc mailing list