diff options
| author | Cody Tapscott <topolarity@tapscott.me> | 2022-11-01 06:20:28 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-11-02 16:58:56 -0400 |
| commit | 98b60992b334df16db1c7f99be466d252d61c4bc (patch) | |
| tree | 2794126e68b9b08afcc136b682301ba43b119e73 /src/type.zig | |
| parent | e50789f1cb13522a3bdace2a2359711163c3fd55 (diff) | |
| download | zig-98b60992b334df16db1c7f99be466d252d61c4bc.tar.gz zig-98b60992b334df16db1c7f99be466d252d61c4bc.zip | |
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.
Diffstat (limited to 'src/type.zig')
| -rw-r--r-- | src/type.zig | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/type.zig b/src/type.zig index 3a072a2f5b..c4276185ca 100644 --- a/src/type.zig +++ b/src/type.zig @@ -2919,7 +2919,10 @@ pub const Type = extern union { return AbiAlignmentAdvanced{ .scalar = abiAlignment(u80_ty, target) }; }, }, - .f128 => return AbiAlignmentAdvanced{ .scalar = 16 }, + .f128 => switch (CType.longdouble.sizeInBits(target)) { + 128 => return AbiAlignmentAdvanced{ .scalar = CType.longdouble.alignment(target) }, + else => return AbiAlignmentAdvanced{ .scalar = 16 }, + }, // TODO revisit this when we have the concept of the error tag type .anyerror_void_error_union, |
