diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-11-13 20:33:13 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-11-16 01:12:27 +0200 |
| commit | b6b3462796fe38a071e6ed2cbcdbb5b024359f35 (patch) | |
| tree | a27dc4a4b577c70aa478dedc0704ef5404e4423a /src/Sema.zig | |
| parent | 11c64bfe6ec921a481b340392ab1d2377359586d (diff) | |
| download | zig-b6b3462796fe38a071e6ed2cbcdbb5b024359f35.tar.gz zig-b6b3462796fe38a071e6ed2cbcdbb5b024359f35.zip | |
std.mem.Allocator: do not return undefined pointers from `create`
Closes #13517
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 493202982e..0dc53c90fa 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -18754,7 +18754,7 @@ fn zirIntToPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai const addr = val.toUnsignedInt(target); if (!ptr_ty.isAllowzeroPtr() and addr == 0) return sema.fail(block, operand_src, "pointer type '{}' does not allow address zero", .{ptr_ty.fmt(sema.mod)}); - if (addr != 0 and addr % ptr_align != 0) + if (addr != 0 and ptr_align != 0 and addr % ptr_align != 0) return sema.fail(block, operand_src, "pointer type '{}' requires aligned address", .{ptr_ty.fmt(sema.mod)}); const val_payload = try sema.arena.create(Value.Payload.U64); |
