diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-12-29 00:39:25 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-12-29 00:39:25 -0700 |
| commit | be5130ec535456559497ac241ac9fa76c4bbb8ca (patch) | |
| tree | 072927858110cb69ccc85c31ed1b2055ee83875e /test/behavior/align.zig | |
| parent | efb7148a4574c608b21359fcbf2edf06afdb5e0c (diff) | |
| download | zig-be5130ec535456559497ac241ac9fa76c4bbb8ca.tar.gz zig-be5130ec535456559497ac241ac9fa76c4bbb8ca.zip | |
compiler_rt: move more functions to the stage2 section
also move more already-passing behavior tests to the passing section.
Diffstat (limited to 'test/behavior/align.zig')
| -rw-r--r-- | test/behavior/align.zig | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/behavior/align.zig b/test/behavior/align.zig index 76a024b88f..77d2eea6a8 100644 --- a/test/behavior/align.zig +++ b/test/behavior/align.zig @@ -120,3 +120,18 @@ test "size of extern struct with 128-bit field" { }) == 32); } } + +test "@ptrCast preserves alignment of bigger source" { + var x: u32 align(16) = 1234; + const ptr = @ptrCast(*u8, &x); + try expect(@TypeOf(ptr) == *align(16) u8); +} + +test "alignstack" { + try expect(fnWithAlignedStack() == 1234); +} + +fn fnWithAlignedStack() i32 { + @setAlignStack(256); + return 1234; +} |
