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;
gcc
.comm ld1,16,16
.comm ld2,32,32
.comm ld3,48,32
clang
.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
.