From 2d6d2a1d11bfca780e559303904571a93bace86b Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Thu, 15 Jun 2023 01:30:06 -0400 Subject: cbe: add missing cast for `@intToPtr` values --- src/codegen/c.zig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/codegen') diff --git a/src/codegen/c.zig b/src/codegen/c.zig index c1b7bd72b1..d06f01c2c3 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -596,9 +596,11 @@ pub const DeclGen = struct { }, location, ), - .int => |int| try writer.print("{x}", .{ - try dg.fmtIntLiteral(Type.usize, int.toValue(), .Other), - }), + .int => |int| { + try writer.writeByte('('); + try dg.renderCType(writer, ptr_cty); + try writer.print("){x}", .{try dg.fmtIntLiteral(Type.usize, int.toValue(), .Other)}); + }, .eu_payload, .opt_payload => |base| { const ptr_base_ty = mod.intern_pool.typeOf(base).toType(); const base_ty = ptr_base_ty.childType(mod); -- cgit v1.2.3