diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-05-12 16:22:37 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-06-10 20:46:17 -0700 |
| commit | 88dbd62bcbac24c09791a7838d2f08c2f540967a (patch) | |
| tree | 9935a67bb6644fc448513eb728a1f22a587a89fb /src/link | |
| parent | d89807efbb1bd5af0a92544298fc08ad6ba2d255 (diff) | |
| download | zig-88dbd62bcbac24c09791a7838d2f08c2f540967a.tar.gz zig-88dbd62bcbac24c09791a7838d2f08c2f540967a.zip | |
stage2: move enum tag values into the InternPool
I'm seeing a new assertion trip: the call to `enumTagFieldIndex` in the
implementation of `@Type` is attempting to query the field index of an
union's enum tag, but the type of the enum tag value provided is not the
same as the union's tag type. Most likely this is a problem with type
coercion, since values are now typed.
Another problem is that I added some hacks in std.builtin because I
didn't see any convenient way to access them from Sema. That should
definitely be cleaned up before merging this branch.
Diffstat (limited to 'src/link')
| -rw-r--r-- | src/link/Coff.zig | 2 | ||||
| -rw-r--r-- | src/link/Elf.zig | 2 | ||||
| -rw-r--r-- | src/link/MachO.zig | 2 | ||||
| -rw-r--r-- | src/link/Wasm.zig | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 4e75cfff97..452356de2c 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -1304,7 +1304,7 @@ fn getDeclOutputSection(self: *Coff, decl_index: Module.Decl.Index) u16 { const zig_ty = ty.zigTypeTag(mod); const val = decl.val; const index: u16 = blk: { - if (val.isUndefDeep()) { + if (val.isUndefDeep(mod)) { // TODO in release-fast and release-small, we should put undef in .bss break :blk self.data_section_index.?; } diff --git a/src/link/Elf.zig b/src/link/Elf.zig index c80d60d72a..b27967884e 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -2456,7 +2456,7 @@ fn getDeclShdrIndex(self: *Elf, decl_index: Module.Decl.Index) u16 { const zig_ty = ty.zigTypeTag(mod); const val = decl.val; const shdr_index: u16 = blk: { - if (val.isUndefDeep()) { + if (val.isUndefDeep(mod)) { // TODO in release-fast and release-small, we should put undef in .bss break :blk self.data_section_index.?; } diff --git a/src/link/MachO.zig b/src/link/MachO.zig index 06f79cf3fb..e7723595db 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -2270,7 +2270,7 @@ fn getDeclOutputSection(self: *MachO, decl_index: Module.Decl.Index) u8 { const single_threaded = self.base.options.single_threaded; const sect_id: u8 = blk: { // TODO finish and audit this function - if (val.isUndefDeep()) { + if (val.isUndefDeep(mod)) { if (mode == .ReleaseFast or mode == .ReleaseSmall) { @panic("TODO __DATA,__bss"); } else { diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index ddf5130fd2..ef97a7fa7f 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -3374,7 +3374,7 @@ pub fn flushModule(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Nod } else if (decl.getVariable()) |variable| { if (!variable.is_mutable) { try wasm.parseAtom(atom_index, .{ .data = .read_only }); - } else if (variable.init.isUndefDeep()) { + } else if (variable.init.isUndefDeep(mod)) { // for safe build modes, we store the atom in the data segment, // whereas for unsafe build modes we store it in bss. const is_initialized = wasm.base.options.optimize_mode == .Debug or |
