stage1: Add missing bitcast when rendering var ptr

Some types require this extra bitcast, eg. structs or unions with extra
padding fields inserted by the compiler.

Fixes #7250
This commit is contained in:
LemonBoy
2020-11-29 11:53:08 +01:00
committed by Andrew Kelley
parent 48660371a2
commit c80d196094
3 changed files with 38 additions and 7 deletions

View File

@@ -60,6 +60,7 @@ comptime {
_ = @import("behavior/bugs/7027.zig");
_ = @import("behavior/bugs/7047.zig");
_ = @import("behavior/bugs/7003.zig");
_ = @import("behavior/bugs/7250.zig");
_ = @import("behavior/bugs/394.zig");
_ = @import("behavior/bugs/421.zig");
_ = @import("behavior/bugs/529.zig");

View File

@@ -0,0 +1,15 @@
const nrfx_uart_t = extern struct {
p_reg: [*c]u32,
drv_inst_idx: u8,
};
pub fn nrfx_uart_rx(p_instance: [*c]const nrfx_uart_t) void {}
threadlocal var g_uart0 = nrfx_uart_t{
.p_reg = 0,
.drv_inst_idx = 0,
};
test "reference a global threadlocal variable" {
_ = nrfx_uart_rx(&g_uart0);
}