mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
C backend: fix codegen for field_ptr/elem_ptr values
This commit is contained in:
parent
2f0204aca3
commit
4a6454fb8d
@ -464,7 +464,7 @@ pub const DeclGen = struct {
|
||||
.variable => ptr_val.castTag(.variable).?.data.owner_decl,
|
||||
else => unreachable,
|
||||
};
|
||||
try dg.renderDeclValue(writer, decl.ty, ptr_val, decl);
|
||||
try dg.renderDeclName(decl, writer);
|
||||
return decl.ty;
|
||||
},
|
||||
.field_ptr => {
|
||||
@ -490,7 +490,7 @@ pub const DeclGen = struct {
|
||||
},
|
||||
.elem_ptr => {
|
||||
const elem_ptr = ptr_val.castTag(.elem_ptr).?.data;
|
||||
try writer.writeAll("&(*");
|
||||
try writer.writeAll("&(");
|
||||
const container_ty = try dg.renderChildPtr(writer, elem_ptr.array_ptr);
|
||||
try writer.print(")[{d}]", .{elem_ptr.index});
|
||||
return container_ty.childType();
|
||||
|
||||
@ -100,19 +100,19 @@ test {
|
||||
|
||||
if (builtin.zig_backend != .stage2_wasm) {
|
||||
// Tests that pass for stage1, llvm backend, C backend
|
||||
_ = @import("behavior/bugs/9584.zig");
|
||||
_ = @import("behavior/cast_int.zig");
|
||||
_ = @import("behavior/eval.zig");
|
||||
_ = @import("behavior/int128.zig");
|
||||
_ = @import("behavior/merge_error_sets.zig");
|
||||
_ = @import("behavior/translate_c_macros.zig");
|
||||
|
||||
if (builtin.zig_backend != .stage2_c) {
|
||||
// Tests that pass for stage1 and the llvm backend.
|
||||
_ = @import("behavior/atomics.zig");
|
||||
_ = @import("behavior/bugs/9584.zig");
|
||||
_ = @import("behavior/eval.zig");
|
||||
_ = @import("behavior/floatop.zig");
|
||||
_ = @import("behavior/math.zig");
|
||||
_ = @import("behavior/maximum_minimum.zig");
|
||||
_ = @import("behavior/merge_error_sets.zig");
|
||||
_ = @import("behavior/popcount.zig");
|
||||
_ = @import("behavior/saturating_arithmetic.zig");
|
||||
_ = @import("behavior/sizeof_and_typeof.zig");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user