• Uncategorized

About c : Different-alignment-of-long-doubles-in-a-struct-on-64-bit-linux-with-gcc-and-clang

Question Detail

I noticed that gcc and clang compile the following code differently:

struct { long double ld[1]; } ld1;
struct { long double ld[2]; } ld2;
struct { long double ld[3]; } ld3;


.comm   ld1,16,16
.comm   ld2,32,32
.comm   ld3,48,32


.type   ld1,@object             # @ld1
.comm   ld1,16,16
.type   ld2,@object             # @ld2
.comm   ld2,32,16
.type   ld3,@object             # @ld3
.comm   ld3,48,16

According to the x86_64 ABI, the alignment should be 16. Why is gcc aligning the latter two structs on 32?

I am using gcc Ubuntu 9.3.0-17ubuntu1~20.04 9.3.0 and clang 10.0.0-4ubuntu1 on Ubuntu 20.04.1 LTS.

Question Answer

No answer for now.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.