authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-25 16:17:00-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-28 17:07:21-07:00
log3d9b6cfcc9341cef40a8a525a4acf8be8b81992c
tree4ac796abca2c07800e7438bdf71c6d517e9c0f4e
parent56129d26ebd8c54563e92a78b9dab20f69dbc646

stage2: add an explicit padding field to avoid Valgrind warning

Adds a `unused: u32 = 0` field to `Zir.Header`. We could leave this as padding, however it triggers a Valgrind warning because we read and write undefined bytes to the file system. This is harmless, but it's essentially free to have a zero field here and makes the warning go away, making it more likely that following Valgrind warnings will be taken seriously.

1 files changed, 5 insertions(+), 1 deletions(-)

src/Zir.zig+5-1
......@@ -43,7 +43,11 @@ pub const Header = extern struct {
4343 instructions_len: u32,
4444 string_bytes_len: u32,
4545 extra_len: u32,
46
46 /// We could leave this as padding, however it triggers a Valgrind warning because
47 /// we read and write undefined bytes to the file system. This is harmless, but
48 /// it's essentially free to have a zero field here and makes the warning go away,
49 /// making it more likely that following Valgrind warnings will be taken seriously.
50 unused: u32 = 0,
4751 stat_inode: std.fs.File.INode,
4852 stat_size: u64,
4953 stat_mtime: i128,