Skip to content

Commit 98b6099

Browse files
topolarityandrewrk
authored andcommitted
stage2: Ensure f128 alignment matches c_longdouble alignment
On platforms where c_longdouble is 128-bits, interop with C code is simplified by making f128 match the alignment of c_longdouble. I intended to make this change as part of #13257, but I missed this part.
1 parent e50789f commit 98b6099

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/type.zig

+4-1
Original file line numberDiff line numberDiff line change
@@ -2919,7 +2919,10 @@ pub const Type = extern union {
29192919
return AbiAlignmentAdvanced{ .scalar = abiAlignment(u80_ty, target) };
29202920
},
29212921
},
2922-
.f128 => return AbiAlignmentAdvanced{ .scalar = 16 },
2922+
.f128 => switch (CType.longdouble.sizeInBits(target)) {
2923+
128 => return AbiAlignmentAdvanced{ .scalar = CType.longdouble.alignment(target) },
2924+
else => return AbiAlignmentAdvanced{ .scalar = 16 },
2925+
},
29232926

29242927
// TODO revisit this when we have the concept of the error tag type
29252928
.anyerror_void_error_union,

0 commit comments

Comments
 (0)