Skip to content

Commit 2fefc0b

Browse files
authored
Zir: add missing extra index for linksection_or_addspace
Closes #18052 Closes #18104 Signed-off-by: Tw <[email protected]>
1 parent 648f592 commit 2fefc0b

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/Zir.zig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3416,8 +3416,9 @@ pub const DeclIterator = struct {
34163416
it.extra_index += 5; // src_hash(4) + line(1)
34173417
const name = it.zir.nullTerminatedString(it.zir.extra[it.extra_index]);
34183418
it.extra_index += 3; // name(1) + value(1) + doc_comment(1)
3419-
it.extra_index += @as(u1, @truncate(flags >> 2));
3420-
it.extra_index += @as(u1, @truncate(flags >> 3));
3419+
it.extra_index += @as(u1, @truncate(flags >> 2)); // align
3420+
it.extra_index += @as(u1, @truncate(flags >> 3)); // link_section
3421+
it.extra_index += @as(u1, @truncate(flags >> 3)); // address_space
34213422

34223423
return Item{
34233424
.sub_index = sub_index,

test/behavior.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ test {
228228
_ = @import("behavior/type.zig");
229229
_ = @import("behavior/type_info.zig");
230230
_ = @import("behavior/type_info_only_pub_decls.zig");
231+
_ = @import("behavior/type_info_mul_linksection_addrspace_decls.zig");
231232
_ = @import("behavior/typename.zig");
232233
_ = @import("behavior/undefined.zig");
233234
_ = @import("behavior/underscore.zig");
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const std = @import("std");
2+
const expect = std.testing.expect;
3+
4+
pub const a linksection("sec_a") = 0;
5+
pub const b linksection("sec_b") = 0;
6+
pub const c addrspace("space_c") = 0;
7+
pub const d addrspace("space_d") = 0;
8+
9+
test {
10+
const decls = @typeInfo(@This()).Struct.decls;
11+
try expect(decls.len == 4);
12+
}

0 commit comments

Comments
 (0)