| author | |
| committer | |
| log | 54a25d82566393adad3befbe80a5113cb1f980c9 |
| tree | 92cc09a8305c8bd5f83c0fcbb71f3da34f0d0b0e |
| parent | a7d38d344801f59b1aab39e8a508c13c507dec14 |
This operation used to be implied by the old incorrect alignment
calculation, but seems to apply even when the alignment is saturated.
Closes #371102 files changed, 10 insertions(+), 1 deletions(-)
src/Type.zig+4-1| ... | @@ -1151,7 +1151,10 @@ pub fn abiSize(ty: Type, zcu: *const Zcu) u64 { | ... | @@ -1151,7 +1151,10 @@ pub fn abiSize(ty: Type, zcu: *const Zcu) u64 { |
| 1151 | std.zig.target.compilerRtFloatAbi(target, elem_ty.floatBits(target)) | 1151 | std.zig.target.compilerRtFloatAbi(target, elem_ty.floatBits(target)) |
| 1152 | else | 1152 | else |
| 1153 | .hard) { | 1153 | .hard) { |
| 1154 | .hard => @divCeil(vec.len * elem_ty.bitSize(zcu), 8), | 1154 | .hard => switch (vec.len * elem_ty.bitSize(zcu)) { |
| 1155 | 0 => return 0, | ||
| 1156 | else => |bits| std.math.ceilPowerOfTwoAssert(u32, @intCast(@divCeil(bits, 8))), | ||
| 1157 | }, | ||
| 1155 | .soft => vec.len * elem_ty.abiSize(zcu), | 1158 | .soft => vec.len * elem_ty.abiSize(zcu), |
| 1156 | }, | 1159 | }, |
| 1157 | .stage2_c, .stage2_wasm => vec.len * elem_ty.abiSize(zcu), | 1160 | .stage2_c, .stage2_wasm => vec.len * elem_ty.abiSize(zcu), |
test/behavior/error.zig+6| ... | @@ -1138,3 +1138,9 @@ test "@errorCast into other inferred error set" { | ... | @@ -1138,3 +1138,9 @@ test "@errorCast into other inferred error set" { |
| 1138 | const non_err: Ies!u32 = @errorCast(@as(error{}!u32, 123)); | 1138 | const non_err: Ies!u32 = @errorCast(@as(error{}!u32, 123)); |
| 1139 | try expect(try non_err == 123); | 1139 | try expect(try non_err == 123); |
| 1140 | } | 1140 | } |
| 1141 | |||
| 1142 | test "error union with vector type" { | ||
| 1143 | var x: anyerror!@Vector(5, f64) = undefined; | ||
| 1144 | x = error.Expected; | ||
| 1145 | try expect(x == error.Expected); | ||
| 1146 | } |