diff options
| author | LemonBoy <thatlemon@gmail.com> | 2020-11-29 11:53:08 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-11-29 10:37:06 -0800 |
| commit | c80d196094de3e0258b4a1146cff56576ec8e95d (patch) | |
| tree | 1f42f229449123b6adb3624ec793962674e17b39 /test | |
| parent | 48660371a2f66b3859831abb276180c557a12f93 (diff) | |
| download | zig-c80d196094de3e0258b4a1146cff56576ec8e95d.tar.gz zig-c80d196094de3e0258b4a1146cff56576ec8e95d.zip | |
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
Diffstat (limited to 'test')
| -rw-r--r-- | test/stage1/behavior.zig | 1 | ||||
| -rw-r--r-- | test/stage1/behavior/bugs/7250.zig | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/test/stage1/behavior.zig b/test/stage1/behavior.zig index 662a7383b3..db6e596291 100644 --- a/test/stage1/behavior.zig +++ b/test/stage1/behavior.zig @@ -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"); diff --git a/test/stage1/behavior/bugs/7250.zig b/test/stage1/behavior/bugs/7250.zig new file mode 100644 index 0000000000..b0f1aa15df --- /dev/null +++ b/test/stage1/behavior/bugs/7250.zig @@ -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); +} |
